Spaces:
Runtime error
Runtime error
julenalvaro
commited on
Commit
•
4c9d5e2
1
Parent(s):
587fbe8
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from transformers import pipeline
|
3 |
+
|
4 |
+
demo = gr.Blocks()
|
5 |
+
|
6 |
+
with demo:
|
7 |
+
gr.Markdown('Este es el segundo demo con blocks')
|
8 |
+
with gr.Tabs(): #vamos a crear pestañas
|
9 |
+
with gr.TabItem('Transcribe audio en español'):
|
10 |
+
with gr.Row():
|
11 |
+
audio = gr.Audio(source = 'microphone', type = 'filepath')
|
12 |
+
transcription = gr.Textbox()
|
13 |
+
b1 = gr.Button('Transcribe audio')
|
14 |
+
|
15 |
+
with gr.TabItem('Análisis del sentimiento en español'):
|
16 |
+
with gr.Row():
|
17 |
+
texto = gr.Textbox()
|
18 |
+
label = gr.Label()
|
19 |
+
b2 = gr.Button('Dime el sentimiento por favor')
|
20 |
+
|
21 |
+
with gr.TabItem('Clasificador de imágenes perros VS gatos'):
|
22 |
+
gr.Row(fn = clasifica_imagen,
|
23 |
+
inputs = gr.Image(shape = (224,224)),
|
24 |
+
outputs = gr.Label(num_top_classes = 3)
|
25 |
+
)
|
26 |
+
|
27 |
+
|
28 |
+
b1.click(audio_a_text, inputs = audio, outputs = transcription)
|
29 |
+
b2.click(texto_a_sentimiento, inputs = texto, outputs = label)
|
30 |
+
|
31 |
+
demo.launch()
|