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() | |