Spaces:
Runtime error
Runtime error
import gradio as gr | |
from transformers import pipeline | |
trans = pipeline("automatic-speech-recognition", "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") | |
audio = gr.Audio(source = "microphone", type = "filepath") | |
texto = gr.Textbox() | |
b1 = gr.Button("Transcribe!") | |
b1.click( | |
fn = audio_a_texto, | |
inputs = audio, | |
outputs = texto | |
) | |
label = gr.Label() | |
b2 = gr.Button("Clasify!") | |
b2.click( | |
fn = texto_a_sentimiento, | |
inputs = texto, | |
outputs = label | |
) | |
demo.launch() | |