Spaces:
Runtime error
Runtime error
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 = """ | |
<p> | |
<center> | |
This model is a fine-tuned version of facebook/wav2vec2-xls-r-300m on the common_voice dataset. | |
</center> | |
</p> | |
<center> | |
<img src="https://huggingface.co/spaces/kingabzpro/real-time-Urdu-ASR/resolve/main/Images/cover.jpg" alt="logo" width="550"/> | |
</center> | |
""" | |
article = "<p style='text-align: center'><a href='https://dagshub.com/kingabzpro/Urdu-ASR-SOTA' target='_blank'>Source Code on DagsHub</a></p><p style='text-align: center'><a href='https://huggingface.co/blog/fine-tune-xlsr-wav2vec2' target='_blank'>Fine-tuning XLS-R for Multi-Lingual ASR with π€ Transformers</a></p></center><center><img src='https://visitor-badge.glitch.me/badge?page_id=kingabzpro/real-time-Urdu-ASR' alt='visitor badge'></center></p>" | |
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() | |