Ar4ikov commited on
Commit
5557412
1 Parent(s): 77783fc

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +32 -0
app.py ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from transformers import pipeline
2
+ import gradio as gr
3
+ from pyctcdecode import BeamSearchDecoderCTC
4
+
5
+ #lmID = "aware-ai/german-lowercase-wiki-5gram"
6
+ #decoder = BeamSearchDecoderCTC.load_from_hf_hub(lmID)
7
+ emo = pipeline("audio-classification", model="Aniemore/wav2vec2-xlsr-53-russian-emotion-recognition")
8
+
9
+
10
+ def transcribe(audio):
11
+ emotion = emo(audio)
12
+ return emotion
13
+
14
+ def get_asr_interface():
15
+ return gr.Interface(
16
+ fn=transcribe,
17
+ inputs=[
18
+ gr.inputs.Audio(source="microphone", type="filepath")
19
+ ],
20
+ outputs=[
21
+ "textbox",
22
+ ])
23
+
24
+ interfaces = [
25
+ get_asr_interface()
26
+ ]
27
+
28
+ names = [
29
+ "ASR"
30
+ ]
31
+
32
+ gr.TabbedInterface(interfaces, names).launch(server_name = "0.0.0.0", enable_queue=False)