Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -10,11 +10,13 @@ def generate_image_caption(image):
|
|
| 10 |
result = img2caption(image)
|
| 11 |
return result[0]['generated_text']
|
| 12 |
|
| 13 |
-
def text2story(text):
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
|
|
|
|
|
|
| 18 |
|
| 19 |
def text2speech(text):
|
| 20 |
"""Converts text to speech using a pre-trained model."""
|
|
|
|
| 10 |
result = img2caption(image)
|
| 11 |
return result[0]['generated_text']
|
| 12 |
|
| 13 |
+
def text2story(text):
|
| 14 |
+
text_to_story_model = pipeline("text-generation", model="pranavpsv/genre-story-generator-v2")
|
| 15 |
+
story_text = text_to_story_model(text, max_new_tokens=150)[0]['generated_text']
|
| 16 |
+
words = story_text.split()
|
| 17 |
+
if len(words) > 100:
|
| 18 |
+
story_text = ' '.join(words[:100]) + '.'
|
| 19 |
+
return story_text
|
| 20 |
|
| 21 |
def text2speech(text):
|
| 22 |
"""Converts text to speech using a pre-trained model."""
|