from transformers import pipeline import gradio as gr import time import unicodedata 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 += unicodedata.normalize("NFC",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.Audio(source="microphone", type="filepath", streaming=True), "state" ], outputs=[ "textbox", "state" ], title=title, description=description, article=article, theme='EveryPizza/Cartoony-Gradio-Theme', live=True).launch()