Update app.py
Browse files
app.py
CHANGED
|
@@ -1,7 +1,17 @@
|
|
| 1 |
import gradio as gr
|
|
|
|
| 2 |
|
| 3 |
-
|
| 4 |
-
return "Hello " + name + "!!"
|
| 5 |
|
| 6 |
-
|
| 7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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()
|