demo-audio / app.py
Esml's picture
update type in parameter passing
bd2ddd9
raw
history blame
653 Bytes
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()