Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -14,6 +14,7 @@ def img2text(url):
|
|
14 |
|
15 |
# text2story
|
16 |
def text2story(text):
|
|
|
17 |
story_generator = pipeline("text-generation", model="distilgpt2")
|
18 |
# Generate a story with a maximum of 90 words
|
19 |
story = story_generator(text, max_length=90, num_return_sequences=1)[0]["generated_text"]
|
@@ -25,7 +26,8 @@ def text2story(text):
|
|
25 |
|
26 |
# text2audio
|
27 |
def text2audio(story_text):
|
28 |
-
|
|
|
29 |
audio_data = tts_pipeline(story_text)
|
30 |
return audio_data
|
31 |
|
|
|
14 |
|
15 |
# text2story
|
16 |
def text2story(text):
|
17 |
+
# Use DistilGPT-2 for text generation
|
18 |
story_generator = pipeline("text-generation", model="distilgpt2")
|
19 |
# Generate a story with a maximum of 90 words
|
20 |
story = story_generator(text, max_length=90, num_return_sequences=1)[0]["generated_text"]
|
|
|
26 |
|
27 |
# text2audio
|
28 |
def text2audio(story_text):
|
29 |
+
# Use FastSpeech 2 for text-to-speech
|
30 |
+
tts_pipeline = pipeline("text-to-speech", model="facebook/fastspeech2-en-ljspeech")
|
31 |
audio_data = tts_pipeline(story_text)
|
32 |
return audio_data
|
33 |
|