speech-to-text / run_demo.py
bofenghuang's picture
switch to non-streaming mode
f0b2cfd
raw
history blame
564 Bytes
from transformers import pipeline
import gradio as gr
pipe = pipeline(model="bhuang/wav2vec2-xls-r-1b-cv9-fr")
def transcribe(audio):
# text = pipe(audio, chunk_length_s=30, stride_length_s=5)["text"]
text = pipe(audio)["text"]
return text
iface = gr.Interface(
fn=transcribe,
inputs=gr.Audio(source="microphone", type="filepath", label="Record something..."),
outputs="text",
title="Speech-to-Text in French",
description="Realtime demo for French automatic speech recognition.",
allow_flagging="never",
)
iface.launch()