Leonel Valencia
Create app.py
c0c3c19 verified
raw
history blame contribute delete
982 Bytes
import gradio as gr
from functions import audio2text, text2sentiment, classify_image
demo = gr.Blocks()
with demo:
gr.Markdown("Este es el segundo demos con Blocks")
with gr.Tabs():
with gr.TabItem("Transcribe audio en espaΓ±ol"):
with gr.Row():
audio = gr.Audio(sources=["microphone"], type="filepath")
transcription = gr.Textbox()
b1 = gr.Button("Transcribe porfa")
with gr.TabItem("Analisis de sentimiento en espaΓ±ol"):
with gr.Row():
texto = gr.Textbox()
label = gr.Label()
b2 = gr.Button("Sentimiento porfa")
with gr.TabItem("Clasificacion de imagenes"):
with gr.Row():
image = gr.Image(type='pil')
lb_image = gr.Label(num_top_classes=3)
b3 = gr.Button("Clasifica tu imagen")
b1.click(audio2text, inputs=audio, outputs=transcription)
b2.click(text2sentiment, inputs=texto, outputs=label)
b3.click(classify_image, inputs=image, outputs=lb_image)
demo.launch()