joey1101 commited on
Commit
307cd05
·
verified ·
1 Parent(s): 8f3a991

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -13,9 +13,9 @@ def img2text(image):
13
  # Function to generate a story based on the caption
14
  def text2story(text):
15
  # Load the text generation model
16
- story_model = pipeline("text-generation", model="distilbert/distilgpt2")
17
  # Generate a story based on the input text
18
- story_text = story_model(f"Once upon a time, {text}.", max_length=100, num_return_sequences=1)
19
  return story_text[0]["generated_text"] # Return the generated story
20
 
21
  # Function to convert text to audio
 
13
  # Function to generate a story based on the caption
14
  def text2story(text):
15
  # Load the text generation model
16
+ story_model = pipeline("text-generation", model="gpt2")
17
  # Generate a story based on the input text
18
+ story_text = story_model(f"Once upon a time, {text}.", max_length=100, num_return_sequences=1, do_sample=True, top_k=50)
19
  return story_text[0]["generated_text"] # Return the generated story
20
 
21
  # Function to convert text to audio