原标题: import openai
导读:
def generate_content(title):prompt = f"Write an article about {title} that is optim...
def generate_content(title):
prompt = f"Write an article about {title} that is optimized for SEO."
response = openai.Completion.create(
engine="davinci",
prompt=prompt,
max_tokens=200
)
content = response.choices[0].text.strip()
return content
def generate_seo_title(title):
prompt = f"What would be a good SEO title for an article about {title}?"
max_tokens=12
seo_title = response.choices[0].text.strip()
return seo_title
# Generate Content
article_title = "5 Tips to Improve Your Productivity"
content_article = generate_content(article_title)
print("Generated Article:")
print(content_article)
print("\n")
# Generate SEO Title
seo_article_title = generate_seo_title(article_title)
print("SEO Title:")
print(seo_article_title)