File size: 452 Bytes
d347b85
932222e
d347b85
932222e
d347b85
932222e
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import gradio as gr
from speechbrain.pretrained import EncoderASR

asr_model = EncoderASR.from_hparams(source="speechbrain/asr-wav2vec2-commonvoice-fr", savedir="pretrained_models/asr-wav2vec2-commonvoice-fr")


def speech_recognize(file):
    text = asr_model.transcribe_file(file)
    return text


iface = gr.Interface(
    fn=speech_recognize, 
    inputs=gr.inputs.Audio(source="microphone", type='filepath'),
    outputs="text",
)
iface.launch()