Mark0047 commited on
Commit
449f254
·
verified ·
1 Parent(s): dd9c994

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -9
app.py CHANGED
@@ -1,12 +1,22 @@
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()
 
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()
13
+
14
+
15
+ import gradio as gr
16
+
17
+ whisper = gr.load("models/superb/wav2vec2-base-superb-er")
18
+
19
+ def transcribe(audio):
20
+ return whisper(audio)
21
 
22
+ gr.Interface(transcribe, gr.Audio(sources=['upload', 'microphone'], type="filepath"), gr.Textbox()).launch()