File size: 1,149 Bytes
b7446da
 
 
 
 
 
 
3b293d4
b7446da
 
 
 
 
1d18900
b7446da
1bc81f7
b7446da
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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()