Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,3 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import streamlit as st
|
2 |
from transformers import pipeline
|
3 |
|
|
|
1 |
+
# function part
|
2 |
+
# img2text
|
3 |
+
def img2text(url):
|
4 |
+
image_to_text_model = pipeline("image-to-text", model="Salesforce/blip-image-captioning-base")
|
5 |
+
text = image_to_text_model(url)[0]["generated_text"]
|
6 |
+
return text
|
7 |
+
|
8 |
+
# text2story
|
9 |
+
def text2story(text):
|
10 |
+
pipe = pipeline("text-generation", model="pranavpsv/genre-story-generator-v2")
|
11 |
+
story_text = pipe(text)[0]['generated_text']
|
12 |
+
return story_text
|
13 |
+
|
14 |
+
# text2audio
|
15 |
+
def text2audio(story_text):
|
16 |
+
pipe = pipeline("text-to-audio", model="Matthijs/mms-tts-eng")
|
17 |
+
audio_data = pipe(story_text)
|
18 |
+
return audio_data
|
19 |
+
|
20 |
import streamlit as st
|
21 |
from transformers import pipeline
|
22 |
|