File size: 653 Bytes
0e77125
 
 
 
 
 
 
 
 
 
 
 
 
 
 
bd2ddd9
 
0e77125
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22

import gradio as gr
from speechbrain.pretrained.interfaces import foreign_class



def main_note(filepath):
    classifier = foreign_class(source="speechbrain/emotion-recognition-wav2vec2-IEMOCAP", pymodule_file="custom_interface.py", classname="CustomEncoderWav2vec2Classifier")
    # out_prob, score, index, text_lab = classifier.classify_file("speechbrain/emotion-recognition-wav2vec2-IEMOCAP/anger.wav")
    out_prob, score, index, text_lab = classifier.classify_file(filepath)
    return text_lab


demo = gr.Interface(
    fn= main_note,
    inputs = gr.Audio(type="filepath"),
    outputs= "text"
)

if __name__ == "__main__":
    demo.launch()