from transformers import pipeline import gradio as gr import time p = pipeline("automatic-speech-recognition",model="kingabzpro/wav2vec2-large-xls-r-300m-Urdu") def transcribe(audio, state=""): time.sleep(2) text = p(audio)["text"] state += text + " " return state, state ################### Gradio Web APP ################################ title = "Real-Time Urdu ASR" description = """

This model is a fine-tuned version of facebook/wav2vec2-xls-r-300m on the common_voice dataset.

logo
""" article = "

Source Code on DagsHub

Fine-tuning XLS-R for Multi-Lingual ASR with 🤗 Transformers

visitor badge

" gr.Interface( fn=transcribe, inputs=[ gr.inputs.Audio(source="microphone", type="filepath"), "state" ], outputs=[ "textbox", "state" ], title=title, description=description, article=article, live=True).launch()