Skip to content

Instantly share code, notes, and snippets.

@astoeckl
Created October 9, 2022 07:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save astoeckl/cebbbdbaf8987e8c500ffd2814a6c076 to your computer and use it in GitHub Desktop.
Save astoeckl/cebbbdbaf8987e8c500ffd2814a6c076 to your computer and use it in GitHub Desktop.
import openai
openai.api_key = YOUROPENAIKEY
newstext = result["text"]
prompt = "Newstext:\n" + newstext + "\nTitle:\n *"
response = openai.Completion.create(
engine="text-davinci-002",
prompt=str(prompt),
temperature=0,
max_tokens=100,
top_p=1,
frequency_penalty=0,
presence_penalty=0
)
resulttext = "*" + response["choices"][0]["text"]
print(resulttext)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment