File size: 781 Bytes
5557412
 
 
 
 
 
5e776dc
5557412
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
from transformers import pipeline
import gradio as gr
from pyctcdecode import BeamSearchDecoderCTC

#lmID = "aware-ai/german-lowercase-wiki-5gram"
#decoder = BeamSearchDecoderCTC.load_from_hf_hub(lmID)
emo = pipeline("audio-classification", model="Aniemore/wav2vec2-xlsr-53-russian-emotion-recognition", trust_remote_code=True)


def transcribe(audio):
    emotion = emo(audio)
    return emotion

def get_asr_interface():
    return gr.Interface(
        fn=transcribe, 
        inputs=[
            gr.inputs.Audio(source="microphone", type="filepath")
        ],
        outputs=[
            "textbox",
        ])
        
interfaces = [
    get_asr_interface()
]

names = [
    "ASR"
]

gr.TabbedInterface(interfaces, names).launch(server_name = "0.0.0.0", enable_queue=False)