steviebarot commited on
Commit
c2f2467
·
1 Parent(s): 91a3917

Add application file

Browse files
Files changed (1) hide show
  1. app.py +19 -0
app.py ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from transformers import pipeline
3
+
4
+ classifier = pipeline('audio-classification', model="steviebarot/filipino-SER")
5
+
6
+ def understand(audio):
7
+ emotions = classifier(audio)
8
+ labels = [i['label'] for i in emotions]
9
+ scores = [str(round(i['score']*100, 2))+'%' for i in emotions]
10
+ final_string = "\n".join([": ".join([l, s]) for l, s in zip(labels, scores)])
11
+ return final_string
12
+
13
+ app = gr.Interface(fn=understand,
14
+ inputs=gr.Audio(source="microphone",
15
+ type="filepath"),
16
+ outputs="text",
17
+ title="Filipino Speech Emotion Recognition",
18
+ description="Realtime demo for a Filipino Speech Emotion Recognition model. Created by Stevie Barot, Ken Agapito, and AJ Angcos.")
19
+ app.launch()