Update app.py
Browse files
app.py
CHANGED
|
@@ -7,7 +7,7 @@ from reportlab.pdfgen import canvas
|
|
| 7 |
|
| 8 |
def storyGPT(key, name, situation, direction):
|
| 9 |
messages = [{"role": "system", "content": "You are a inspiring storyteller and therapist who understand young people and students' struggle."},
|
| 10 |
-
{"role": "user", "content": "Write the first part amongst
|
| 11 |
|
| 12 |
openai.api_key = key
|
| 13 |
first_part_story = openai.ChatCompletion.create(
|
|
@@ -18,7 +18,7 @@ def storyGPT(key, name, situation, direction):
|
|
| 18 |
|
| 19 |
for i in ["Second"]:
|
| 20 |
new_story_first_half = {
|
| 21 |
-
"role": "user", "content": f"Write the {i} part of the story among
|
| 22 |
messages.append(new_story_first_half)
|
| 23 |
story = openai.ChatCompletion.create(
|
| 24 |
model="gpt-3.5-turbo", messages=messages)
|
|
@@ -27,7 +27,7 @@ def storyGPT(key, name, situation, direction):
|
|
| 27 |
|
| 28 |
# for i in ["Third", "Final"]:
|
| 29 |
# new_story_second_half = {
|
| 30 |
-
# "role": "user", "content": f"Write the {i} part of the story among
|
| 31 |
# messages.append(new_story_second_half)
|
| 32 |
# story = openai.ChatCompletion.create(
|
| 33 |
# model="gpt-3.5-turbo", messages=messages)
|
|
|
|
| 7 |
|
| 8 |
def storyGPT(key, name, situation, direction):
|
| 9 |
messages = [{"role": "system", "content": "You are a inspiring storyteller and therapist who understand young people and students' struggle."},
|
| 10 |
+
{"role": "user", "content": "Write the first part amongst 3 of a story about " + name + "who is "+situation+". Include a bold heading above the top starting with 'First part:'. Limit your answer to 4 sentences or less."}]
|
| 11 |
|
| 12 |
openai.api_key = key
|
| 13 |
first_part_story = openai.ChatCompletion.create(
|
|
|
|
| 18 |
|
| 19 |
for i in ["Second"]:
|
| 20 |
new_story_first_half = {
|
| 21 |
+
"role": "user", "content": f"Write the {i} part of the story among 3 continuing from the previous part. Include a bold heading above the top starting with '{i} part:'. Limit your answer to 4 sentences or less."}
|
| 22 |
messages.append(new_story_first_half)
|
| 23 |
story = openai.ChatCompletion.create(
|
| 24 |
model="gpt-3.5-turbo", messages=messages)
|
|
|
|
| 27 |
|
| 28 |
# for i in ["Third", "Final"]:
|
| 29 |
# new_story_second_half = {
|
| 30 |
+
# "role": "user", "content": f"Write the {i} part of the story among 3 continuing from the previous part"+"in the "+direction+". Include a bold heading above the top starting with '{i} part:'. Limit your answer to 4 sentences or less"}
|
| 31 |
# messages.append(new_story_second_half)
|
| 32 |
# story = openai.ChatCompletion.create(
|
| 33 |
# model="gpt-3.5-turbo", messages=messages)
|