Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,13 +1,17 @@
|
|
1 |
import gradio as gr
|
2 |
from transformers import pipeline
|
|
|
3 |
|
4 |
captioner = pipeline(model="microsoft/git-base")
|
5 |
-
tts =
|
6 |
|
7 |
def predict(image):
|
8 |
text = captioner(image)[0]["generated_text"]
|
9 |
-
|
10 |
-
|
|
|
|
|
|
|
11 |
|
12 |
demo = gr.Interface(
|
13 |
fn=predict,
|
|
|
1 |
import gradio as gr
|
2 |
from transformers import pipeline
|
3 |
+
from TTS.api import TTS
|
4 |
|
5 |
captioner = pipeline(model="microsoft/git-base")
|
6 |
+
tts = TTS(model_name="tts_models/multilingual/multi-dataset/your_tts", progress_bar=False, gpu=False)
|
7 |
|
8 |
def predict(image):
|
9 |
text = captioner(image)[0]["generated_text"]
|
10 |
+
|
11 |
+
audio_output = "output.wav"
|
12 |
+
tts.tts_to_file(text, speaker=tts.speakers[0], language="en", file_path=audio_output)
|
13 |
+
|
14 |
+
return text, audio_output
|
15 |
|
16 |
demo = gr.Interface(
|
17 |
fn=predict,
|