moumeneb1 commited on
Commit
932222e
·
1 Parent(s): e9009e5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -4
app.py CHANGED
@@ -1,7 +1,17 @@
1
  import gradio as gr
 
2
 
3
- def greet(name):
4
- return "Hello " + name + "!!"
5
 
6
- iface = gr.Interface(fn=greet, inputs="text", outputs="text")
7
- iface.launch()
 
 
 
 
 
 
 
 
 
 
 
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()