Spaces:
Runtime error
Runtime error
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 = "<p style='text-align: center'><a href='https://arxiv.org/abs/2005.07143' target='_blank'>ECAPA-TDNN: Emphasized Channel Attention, Propagation and Aggregation in TDNN Based Speaker Verification</a> | <a href='https://github.com/speechbrain/speechbrain' target='_blank'>Github Repo</a></p>" | |
examples = [ | |
['samples_audio_samples_example_fr.wav'] | |
] | |
gr.Interface(speechbrain, inputs, outputs, title=title, description=description, article=article, examples=examples).launch() |