File size: 1,010 Bytes
4c9d5e2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import gradio as gr
from transformers import pipeline

demo = gr.Blocks()

with demo:
  gr.Markdown('Este es el segundo demo con blocks')
  with gr.Tabs(): #vamos a crear pestañas
    with gr.TabItem('Transcribe audio en español'):
      with gr.Row():
        audio = gr.Audio(source = 'microphone', type = 'filepath')
        transcription = gr.Textbox()
      b1 = gr.Button('Transcribe audio')

    with gr.TabItem('Análisis del sentimiento en español'):
      with gr.Row():
          texto = gr.Textbox()
          label = gr.Label()
      b2 = gr.Button('Dime el sentimiento por favor')
        
    with gr.TabItem('Clasificador de imágenes perros VS gatos'):
      gr.Row(fn = clasifica_imagen,
                    inputs = gr.Image(shape = (224,224)),
                    outputs = gr.Label(num_top_classes = 3)
                    )
      
    
    b1.click(audio_a_text, inputs = audio, outputs = transcription)
    b2.click(texto_a_sentimiento, inputs = texto, outputs = label)

demo.launch()