Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -4,8 +4,8 @@ import openai
|
|
4 |
def generate_story(names, story_title, api_key):
|
5 |
openai.api_key = api_key
|
6 |
messages = [
|
7 |
-
{"role": "system", "content": "You are a
|
8 |
-
{"role": "user", "content": f"
|
9 |
]
|
10 |
|
11 |
response = openai.ChatCompletion.create(
|
@@ -16,6 +16,7 @@ def generate_story(names, story_title, api_key):
|
|
16 |
story = response.choices[0].message['content']
|
17 |
return story
|
18 |
|
|
|
19 |
iface = gr.Interface(
|
20 |
fn=generate_story,
|
21 |
inputs=[
|
|
|
4 |
def generate_story(names, story_title, api_key):
|
5 |
openai.api_key = api_key
|
6 |
messages = [
|
7 |
+
{"role": "system", "content": "You are a magical storyteller crafting a children's fantasy tale."},
|
8 |
+
{"role": "user", "content": f"In the mystical land of Fantasia, two young adventurers named {names} set out on a quest to find the lost city of Eloria. Along the way, they encounter magical creatures, enchanted forests, and mysterious puzzles. Tell us their whimsical and heartwarming tale based on the title: '{story_title}'."}
|
9 |
]
|
10 |
|
11 |
response = openai.ChatCompletion.create(
|
|
|
16 |
story = response.choices[0].message['content']
|
17 |
return story
|
18 |
|
19 |
+
|
20 |
iface = gr.Interface(
|
21 |
fn=generate_story,
|
22 |
inputs=[
|