Mark0047 commited on
Commit
c8118bc
·
verified ·
1 Parent(s): 5d13e28

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -0
app.py ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from transformers import pipeline
3
+
4
+ # Load the model
5
+ pipe = pipeline("audio-classification", model="superb/wav2vec2-base-superb-er")
6
+
7
+ def classify_emotion(audio):
8
+ result = pipe(audio, top_k=5)
9
+ return result
10
+
11
+ # Gradio interface for uploading an audio file
12
+ gr.Interface(fn=classify_emotion, inputs=gr.Audio(sources=['upload', 'microphone'], type="filepath"), outputs="text").launch()