Spaces:
Build error
Build error
Update app.py
Browse files
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="
|
| 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'],
|
|
|
|
|
|
|
|
|
|
|
|
| 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
|