Spaces:
Runtime error
Runtime error
Ahsen Khaliq
commited on
Commit
•
b7446da
1
Parent(s):
87db002
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import torchaudio
|
2 |
+
from speechbrain.pretrained import EncoderClassifier
|
3 |
+
import gradio as gr
|
4 |
+
|
5 |
+
classifier = EncoderClassifier.from_hparams(source="speechbrain/lang-id-commonlanguage_ecapa", savedir="pretrained_models/lang-id-commonlanguage_ecapa")
|
6 |
+
def speechbrain(aud):
|
7 |
+
out_prob, score, index, text_lab = classifier.classify_file(aud.name)
|
8 |
+
return text_lab
|
9 |
+
|
10 |
+
inputs = gr.inputs.Audio(label="Input Audio", type="file")
|
11 |
+
outputs = "text"
|
12 |
+
title = "Speechbrain Audio Classification"
|
13 |
+
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."
|
14 |
+
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' '_blank'>Github Repo</a></p>"
|
15 |
+
examples = [
|
16 |
+
['samples_audio_samples_test_mixture.wav']
|
17 |
+
]
|
18 |
+
gr.Interface(speechbrain, inputs, outputs, title=title, description=description, article=article, examples=examples).launch()
|