Spaces:
Sleeping
Sleeping
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 audio2text(audio): | |
text = trans(audio)["text"] | |
return text | |
def text2sentiment(text): | |
return clasificador(text)[0]["label"] | |
demo=gr.Blocks() | |
with demo: | |
gr.Markdown("Audio 2 Text 2 Sentiment") | |
audio=gr.Audio(sources="microphone",type="filepath") | |
texto=gr.Textbox() | |
b1=gr.Button("Transcribe") | |
b1.click(audio2text,inputs=audio,outputs=texto) | |
label=gr.Label() | |
b2=gr.Button("Clasifica el sentimiento") | |
b2.click(text2sentiment,inputs=texto,outputs=label) | |
demo.launch() |