koey811 commited on
Commit
16a7845
·
verified ·
1 Parent(s): 1cdf484

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -18,7 +18,7 @@ except ImportError:
18
  caption_model = pipeline("image-to-text", model="unography/blip-large-long-cap")
19
 
20
  # Load the GPT-2 model for story generation
21
- story_generator = pipeline("text-generation", model="openai-community/gpt2")
22
 
23
  def generate_caption(image):
24
  # Generate the caption for the uploaded image
@@ -27,7 +27,7 @@ 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"Startinh with 'Once upon a time', based on the image described as '{caption}', here is a short and interesting story for children aged 3-10. The story is positive and happy in tone, with added imagination:\n\n"
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
 
18
  caption_model = pipeline("image-to-text", model="unography/blip-large-long-cap")
19
 
20
  # Load the GPT-2 model for story generation
21
+ story_generator = pipeline("text-generation", model="gpt2")
22
 
23
  def generate_caption(image):
24
  # Generate the caption for the uploaded image
 
27
 
28
  def generate_story(caption):
29
  # Generate the story based on the caption using the GPT-2 model
30
+ prompt = f"Starting with 'Once upon a time', based on the image described as '{caption}', here is a short and interesting story for children aged 3-10. The story is positive and happy in tone, with added imagination:\n\n"
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