Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -12,11 +12,17 @@ import IPython.display as ipd
|
|
| 12 |
image_to_text_model = pipeline("image-classification")
|
| 13 |
text_to_audio_model = pipeline("text-to-speech")
|
| 14 |
|
| 15 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
# Funci贸n para la interfaz de Gradio
|
| 17 |
def image_to_audio(input_image):
|
| 18 |
# Convertir la imagen a texto
|
| 19 |
-
text_output =
|
| 20 |
print('text_output is :'+text_output)
|
| 21 |
# Generar audio a partir del texto
|
| 22 |
audio_output = text_to_audio_model(text_output)[0]['audio']
|
|
@@ -27,7 +33,7 @@ def image_to_audio(input_image):
|
|
| 27 |
iface = gr.Interface(
|
| 28 |
fn=image_to_audio,
|
| 29 |
inputs=gr.Image(type='pil'),
|
| 30 |
-
outputs=[gr.Textbox(
|
| 31 |
live=True,
|
| 32 |
interpretation="default",
|
| 33 |
capture_session=True
|
|
|
|
| 12 |
image_to_text_model = pipeline("image-classification")
|
| 13 |
text_to_audio_model = pipeline("text-to-speech")
|
| 14 |
|
| 15 |
+
def image_to_texto(input_image):
|
| 16 |
+
# Convertir la imagen a texto
|
| 17 |
+
text_output = image_to_text_model(input_image)[0]['label']
|
| 18 |
+
print('text_output is :'+text_output)
|
| 19 |
+
|
| 20 |
+
return text_output
|
| 21 |
+
|
| 22 |
# Funci贸n para la interfaz de Gradio
|
| 23 |
def image_to_audio(input_image):
|
| 24 |
# Convertir la imagen a texto
|
| 25 |
+
text_output = image_to_texto(input_image)[0]['label']
|
| 26 |
print('text_output is :'+text_output)
|
| 27 |
# Generar audio a partir del texto
|
| 28 |
audio_output = text_to_audio_model(text_output)[0]['audio']
|
|
|
|
| 33 |
iface = gr.Interface(
|
| 34 |
fn=image_to_audio,
|
| 35 |
inputs=gr.Image(type='pil'),
|
| 36 |
+
outputs=[gr.Textbox(), gr.Audio()],
|
| 37 |
live=True,
|
| 38 |
interpretation="default",
|
| 39 |
capture_session=True
|