koey811 commited on
Commit
5235e45
·
verified ·
1 Parent(s): 620b014

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -27,8 +27,8 @@ def generate_caption(image):
27
 
28
  def generate_story(caption):
29
  # Generate the story based on the caption using the GPT-2 model
30
- prompt = f"Write a short, simple children's story in 100 words based on the following image description:\n\n{caption}\n\nStory:"
31
- story = story_generator(prompt, max_length=200, num_return_sequences=1)[0]["generated_text"]
32
 
33
  # Extract the story text from the generated output
34
  story = story.split("Story:")[1].strip()
 
27
 
28
  def generate_story(caption):
29
  # Generate the story based on the caption using the GPT-2 model
30
+ prompt = f"Write a short, simple children's story approximately 100 words based on the following image description:\n\n{caption}\n\nStory:"
31
+ story = story_generator(prompt, max_length=500, num_return_sequences=1)[0]["generated_text"]
32
 
33
  # Extract the story text from the generated output
34
  story = story.split("Story:")[1].strip()