Spaces:
Runtime error
Runtime error
Leonel Valencia
commited on
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
from functions import audio2text, text2sentiment, classify_image
|
| 3 |
+
|
| 4 |
+
demo = gr.Blocks()
|
| 5 |
+
|
| 6 |
+
with demo:
|
| 7 |
+
gr.Markdown("Este es el segundo demos con Blocks")
|
| 8 |
+
with gr.Tabs():
|
| 9 |
+
with gr.TabItem("Transcribe audio en espaΓ±ol"):
|
| 10 |
+
with gr.Row():
|
| 11 |
+
audio = gr.Audio(sources=["microphone"], type="filepath")
|
| 12 |
+
transcription = gr.Textbox()
|
| 13 |
+
b1 = gr.Button("Transcribe porfa")
|
| 14 |
+
|
| 15 |
+
with gr.TabItem("Analisis de sentimiento en espaΓ±ol"):
|
| 16 |
+
with gr.Row():
|
| 17 |
+
texto = gr.Textbox()
|
| 18 |
+
label = gr.Label()
|
| 19 |
+
b2 = gr.Button("Sentimiento porfa")
|
| 20 |
+
|
| 21 |
+
with gr.TabItem("Clasificacion de imagenes"):
|
| 22 |
+
with gr.Row():
|
| 23 |
+
image = gr.Image(type='pil')
|
| 24 |
+
lb_image = gr.Label(num_top_classes=3)
|
| 25 |
+
b3 = gr.Button("Clasifica tu imagen")
|
| 26 |
+
|
| 27 |
+
b1.click(audio2text, inputs=audio, outputs=transcription)
|
| 28 |
+
b2.click(text2sentiment, inputs=texto, outputs=label)
|
| 29 |
+
b3.click(classify_image, inputs=image, outputs=lb_image)
|
| 30 |
+
|
| 31 |
+
demo.launch()
|