import torchaudio from speechbrain.pretrained import EncoderClassifier import gradio as gr classifier = EncoderClassifier.from_hparams(source="speechbrain/lang-id-commonlanguage_ecapa", savedir="pretrained_models/lang-id-commonlanguage_ecapa") def speechbrain(aud): out_prob, score, index, text_lab = classifier.classify_file(aud.name) return text_lab[0] inputs = gr.inputs.Audio(label="Input Audio", type="file") outputs = "text" title = "Speechbrain Audio Classification" description = "Gradio demo for Audio Classification with SpeechBrain. To use it, simply upload your audio, or click one of the examples to load them. Read more at the links below." article = "

ECAPA-TDNN: Emphasized Channel Attention, Propagation and Aggregation in TDNN Based Speaker Verification | Github Repo

" examples = [ ['samples_audio_samples_example_fr.wav'] ] gr.Interface(speechbrain, inputs, outputs, title=title, description=description, article=article, examples=examples).launch()