steviebarot's picture
Add application file
c2f2467
raw
history blame contribute delete
814 Bytes
import gradio as gr
from transformers import pipeline
classifier = pipeline('audio-classification', model="steviebarot/filipino-SER")
def understand(audio):
emotions = classifier(audio)
labels = [i['label'] for i in emotions]
scores = [str(round(i['score']*100, 2))+'%' for i in emotions]
final_string = "\n".join([": ".join([l, s]) for l, s in zip(labels, scores)])
return final_string
app = gr.Interface(fn=understand,
inputs=gr.Audio(source="microphone",
type="filepath"),
outputs="text",
title="Filipino Speech Emotion Recognition",
description="Realtime demo for a Filipino Speech Emotion Recognition model. Created by Stevie Barot, Ken Agapito, and AJ Angcos.")
app.launch()