LittleLirow commited on
Commit
c36acea
1 Parent(s): a269add

Add story file

Browse files
Files changed (1) hide show
  1. story.py +16 -0
story.py CHANGED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import openai
3
+
4
+ def text2story(text, auth):
5
+ openai.api_key = auth
6
+
7
+ response = openai.ChatCompletion.create(
8
+ model="gpt-3.5-turbo",
9
+ messages=[
10
+ {"role": "system", "content": "You are a psychedelic horror storywriter."},
11
+ {"role": "user", "content": f"Write a narrated story about {text} with a bad ending. It must have between 250 and 750 characters. It must have {text}."}
12
+ ],
13
+ max_tokens=1000,
14
+ temperature=0.7)
15
+
16
+ return response["choices"][0]["message"]["content"]