nniehaus commited on
Commit
b17ee7c
·
1 Parent(s): 8ac623c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -4
app.py CHANGED
@@ -17,12 +17,14 @@ details = st.text_area("Additional Details", placeholder="Any specific details t
17
  # Function to generate the story
18
  def generate_story(age_group, theme, details):
19
  prompt = f"Write a children's story for age group {age_group} about {theme}. Include details such as {details}."
20
- response = openai.Completion.create(
21
  model="gpt-4",
22
- prompt=prompt,
23
- max_tokens=500 # Adjust as needed
 
 
24
  )
25
- return response.choices[0].text
26
 
27
  # Function to generate images
28
  def generate_image(panel_text):
 
17
  # Function to generate the story
18
  def generate_story(age_group, theme, details):
19
  prompt = f"Write a children's story for age group {age_group} about {theme}. Include details such as {details}."
20
+ response = openai.ChatCompletion.create(
21
  model="gpt-4",
22
+ messages=[
23
+ {"role": "system", "content": "You are a creative writer."},
24
+ {"role": "user", "content": prompt}
25
+ ]
26
  )
27
+ return response.choices[0].message['content']
28
 
29
  # Function to generate images
30
  def generate_image(panel_text):