Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -25,7 +25,8 @@ def generate_caption(image):
|
|
25 |
return caption
|
26 |
|
27 |
def generate_story(caption):
|
28 |
-
|
|
|
29 |
story = story_generator(prompt, max_length=500, num_return_sequences=1)[0]["generated_text"]
|
30 |
|
31 |
# Extract the story text from the generated output
|
|
|
25 |
return caption
|
26 |
|
27 |
def generate_story(caption):
|
28 |
+
# Generate the story based on the caption using the GPT-2 model
|
29 |
+
prompt = f"Once upon a time, in a world inspired by the image described as '{caption}', a delightful story unfolded for children aged 3-10. The story should be engaging, easy to understand, and use age-appropriate language. Let's begin the story:\n\n"
|
30 |
story = story_generator(prompt, max_length=500, num_return_sequences=1)[0]["generated_text"]
|
31 |
|
32 |
# Extract the story text from the generated output
|