Spaces:
Sleeping
Sleeping
File size: 534 Bytes
c36acea 08ce9fc c36acea |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
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"] |