Spaces:
Running
Running
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 f"classifer predicts this wave as {text_lab[0]} ; also out_prob is {out_prob}" | |
demo = gr.Interface( | |
fn= main_note, | |
inputs = gr.Audio(type="filepath"), | |
outputs= "text" | |
) | |
if __name__ == "__main__": | |
demo.launch() | |