Update app.py
Browse files
app.py
CHANGED
|
@@ -12,9 +12,15 @@ def img2text(url):
|
|
| 12 |
|
| 13 |
# text2story
|
| 14 |
def text2story(text):
|
| 15 |
-
text_to_story_model = pipeline("text-generation",model="distilbert/distilgpt2")
|
| 16 |
-
|
| 17 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
|
| 19 |
# text2audio
|
| 20 |
def text2audio(story_text):
|
|
|
|
| 12 |
|
| 13 |
# text2story
|
| 14 |
def text2story(text):
|
| 15 |
+
text_to_story_model = pipeline("text-generation", model="distilbert/distilgpt2")
|
| 16 |
+
if isinstance(text, list):
|
| 17 |
+
text = " ".join(text) # Ensure input is a single string
|
| 18 |
+
story_text = text_to_story_model(text, max_length=100, num_return_sequences=1)
|
| 19 |
+
return story_text[0]['generated_text']
|
| 20 |
+
|
| 21 |
+
#text_to_story_model = pipeline("text-generation",model="distilbert/distilgpt2")
|
| 22 |
+
#story_text = text_to_story_model(text,max_length=100,num_return_sequences=1)
|
| 23 |
+
#return story_text
|
| 24 |
|
| 25 |
# text2audio
|
| 26 |
def text2audio(story_text):
|