Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,24 +1,32 @@
|
|
1 |
import gradio as gr
|
2 |
from transformers import pipeline
|
|
|
3 |
|
4 |
pipe = pipeline("image-to-text",
|
5 |
model="Salesforce/blip-image-captioning-base")
|
6 |
|
7 |
-
|
8 |
-
|
9 |
-
|
|
|
10 |
|
11 |
iface = gr.Interface(launch,
|
12 |
inputs=gr.Image(type='pil'),
|
13 |
outputs="text")
|
14 |
|
15 |
-
tts_pipe = pipeline("text-to-speech",
|
16 |
-
model="kakao-enterprise/vits-ljs")
|
17 |
-
text = iface.launch()
|
18 |
|
19 |
narrated_text = tts_pipe(text)
|
20 |
|
21 |
-
from IPython.display import Audio as IPythonAudio
|
22 |
-
|
23 |
IPythonAudio(narrated_text["audio"][0],
|
24 |
-
rate=narrated_text["sampling_rate"])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
from transformers import pipeline
|
3 |
+
from IPython.display import Audio as IPythonAudio
|
4 |
|
5 |
pipe = pipeline("image-to-text",
|
6 |
model="Salesforce/blip-image-captioning-base")
|
7 |
|
8 |
+
|
9 |
+
text = pipe(input)
|
10 |
+
tts_pipe = pipeline("text-to-speech",
|
11 |
+
model="kakao-enterprise/vits-ljs")
|
12 |
|
13 |
iface = gr.Interface(launch,
|
14 |
inputs=gr.Image(type='pil'),
|
15 |
outputs="text")
|
16 |
|
|
|
|
|
|
|
17 |
|
18 |
narrated_text = tts_pipe(text)
|
19 |
|
|
|
|
|
20 |
IPythonAudio(narrated_text["audio"][0],
|
21 |
+
rate=narrated_text["sampling_rate"])
|
22 |
+
|
23 |
+
def launch(input):
|
24 |
+
out = pipe(input)
|
25 |
+
return out[0]['generated_text']
|
26 |
+
|
27 |
+
iface.launch()
|
28 |
+
|
29 |
+
|
30 |
+
|
31 |
+
|
32 |
+
|