joey1101 commited on
Commit
e4d5b38
·
verified ·
1 Parent(s): 513d062

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -13,7 +13,7 @@ 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="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)
19
  return story_text[0]["generated_text"] # Return the generated story
@@ -52,4 +52,7 @@ if uploaded_file is not None:
52
 
53
  # Play button for the audio
54
  if st.button("Play Audio"): # Create a button to play the audio
55
- st.audio(audio_data['audio'], format="audio/wav", start_time=0, sample_rate=audio_data['sampling_rate']) # Play the 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="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
 
52
 
53
  # Play button for the audio
54
  if st.button("Play Audio"): # Create a button to play the audio
55
+ st.audio(audio_data['audio'],
56
+ format="audio/wav",
57
+ start_time=0,
58
+ sample_rate=audio_data['sampling_rate']) # Play the audio