julenalvaro's picture
Create app.py
4c9d5e2
raw
history blame
1.01 kB
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()