Spaces:
Sleeping
Sleeping
import os | |
import openai | |
def text2story(text, auth): | |
openai.api_key = auth | |
response = openai.ChatCompletion.create( | |
model="gpt-3.5-turbo", | |
messages=[ | |
{"role": "system", "content": "You are a psychedelic horror storywriter."}, | |
{"role": "user", "content": f"Write a short narrated story about {text} with a bad ending. It must have {text}."} | |
], | |
max_tokens=1000, | |
temperature=0.7) | |
return response["choices"][0]["message"]["content"] |