Blessin commited on
Commit
aa9f188
·
1 Parent(s): 178723a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -2
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 helpful assistant."},
8
- {"role": "user", "content": f"Title: {story_title}. In a fantasy world, {names} embarked on an absurd and funny journey. {names}"}
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=[