Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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.
|
| 21 |
model="gpt-4",
|
| 22 |
-
|
| 23 |
-
|
|
|
|
|
|
|
| 24 |
)
|
| 25 |
-
return response.choices[0].
|
| 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):
|