Abdelmoumene Boumadane
commited on
Commit
·
d347b85
1
Parent(s):
f843ba7
added the asr space
Browse files- app.py +18 -0
- requirements.txt +1 -0
app.py
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
from speechbrain.pretrained import EncoderASR
|
| 3 |
+
|
| 4 |
+
asr_model = EncoderASR.from_hparams(source="speechbrain/asr-wav2vec2-commonvoice-fr", savedir="pretrained_models/asr-wav2vec2-commonvoice-fr")
|
| 5 |
+
|
| 6 |
+
|
| 7 |
+
def speech_recognize(file):
|
| 8 |
+
text = asr_model.transcribe_file(file)
|
| 9 |
+
return text
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
iface = gr.Interface(
|
| 13 |
+
fn=speech_recognize,
|
| 14 |
+
inputs=gr.inputs.Audio(source="microphone", type='filepath'),
|
| 15 |
+
outputs="text",
|
| 16 |
+
)
|
| 17 |
+
iface.launch()
|
| 18 |
+
|
requirements.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
speechbrain
|