Spaces:
Runtime error
Runtime error
import gradio as gr | |
from transformers import pipeline | |
#trans = pipeline("automatic-speech-recognition", model = "facebook/wav2vec2-large-xlsr-53-spanish") | |
clasificador = pipeline("text-classification", model = "pysentimiento/robertuito-sentiment-analysis") | |
#def audio_a_texto(audio): | |
# text = trans(audio)["text"] | |
# return text | |
def texto_a_sentimiento(text): | |
return clasificador(text)[0]["label"] | |
demo = gr.Blocks() | |
with demo: | |
gr.Markdown("Demo para workshop Campus 42 Fundaci贸n Telef贸nica") | |
with gr.Tabs(): | |
#with gr.TabItem("Transcribe audio en espa帽ol"): | |
# with gr.Row(): | |
# audio = gr.Audio(source="microphone", type="filepath") | |
# transcripcion = gr.Textbox() | |
# b1 = gr.Button("Transcribe porfa") | |
with gr.TabItem("An谩lisis de sentimiento en espa帽ol"): | |
with gr.Row(): | |
texto = gr.Textbox() | |
label = gr.Label() | |
b2 = gr.Button("Analiza el sentimiento, por favor") | |
#b1.click(audio_a_texto, inputs=audio, outputs=transcripcion) | |
b2.click(texto_a_sentimiento, inputs=texto, outputs=label) | |
demo.launch() |