-
-
Save Mediatros/a72ce6caecac9d4f1fca8124ba16c1c7 to your computer and use it in GitHub Desktop.
AI Blog Generator Tool
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import openai | |
import config | |
openai.api_key = config.OPENAI_API_KEY | |
def generateBlogTopics(prompt1): | |
response = openai.Completion.create( | |
engine="davinci-instruct-beta-v3", | |
prompt="Generate blog topics on: {}. \n \n 1. ".format(prompt1), | |
temperature=0.7, | |
max_tokens=100, | |
top_p=1, | |
frequency_penalty=0, | |
presence_penalty=0 | |
) | |
return response['choices'][0]['text'] | |
def generateBlogSections(prompt1): | |
response = openai.Completion.create( | |
engine="davinci-instruct-beta-v3", | |
prompt="Expand the blog title in to high level blog sections: {} \n\n- Introduction: ".format(prompt1), | |
temperature=0.6, | |
max_tokens=100, | |
top_p=1, | |
frequency_penalty=0, | |
presence_penalty=0 | |
) | |
return response['choices'][0]['text'] | |
def blogSectionExpander(prompt1): | |
response = openai.Completion.create( | |
engine="davinci-instruct-beta-v3", | |
prompt="Expand the blog section in to a detailed professional , witty and clever explanation.\n\n {}".format(prompt1), | |
temperature=0.7, | |
max_tokens=200, | |
top_p=1, | |
frequency_penalty=0, | |
presence_penalty=0 | |
) | |
return response['choices'][0]['text'] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment