Spaces:
Runtime error
Runtime error
Abid
commited on
Commit
β’
34aa4f5
1
Parent(s):
bd2e355
urdu app added
Browse files- Images/cover.jpg +0 -0
- README.md +4 -5
- app.py +44 -0
- packages.txt +1 -0
- requirements.txt +2 -0
Images/cover.jpg
ADDED
README.md
CHANGED
@@ -1,13 +1,12 @@
|
|
1 |
---
|
2 |
-
title:
|
3 |
-
emoji:
|
4 |
-
colorFrom:
|
5 |
-
colorTo:
|
6 |
sdk: gradio
|
7 |
sdk_version: 2.9.0
|
8 |
app_file: app.py
|
9 |
pinned: false
|
10 |
-
license: apache-2.0
|
11 |
---
|
12 |
|
13 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces#reference
|
|
|
1 |
---
|
2 |
+
title: Streaming Urdu Asr
|
3 |
+
emoji: π
|
4 |
+
colorFrom: pink
|
5 |
+
colorTo: green
|
6 |
sdk: gradio
|
7 |
sdk_version: 2.9.0
|
8 |
app_file: app.py
|
9 |
pinned: false
|
|
|
10 |
---
|
11 |
|
12 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces#reference
|
app.py
ADDED
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from transformers import pipeline
|
2 |
+
import gradio as gr
|
3 |
+
import time
|
4 |
+
|
5 |
+
p = pipeline("automatic-speech-recognition",model="kingabzpro/wav2vec2-large-xls-r-300m-Urdu")
|
6 |
+
|
7 |
+
def transcribe(audio, state=""):
|
8 |
+
time.sleep(2)
|
9 |
+
text = p(audio)["text"]
|
10 |
+
state += text + " "
|
11 |
+
return state, state
|
12 |
+
|
13 |
+
################### Gradio Web APP ################################
|
14 |
+
|
15 |
+
title = "Real-Time Urdu ASR"
|
16 |
+
|
17 |
+
description = """
|
18 |
+
<p>
|
19 |
+
<center>
|
20 |
+
This model is a fine-tuned version of facebook/wav2vec2-xls-r-300m on the common_voice dataset.
|
21 |
+
</center>
|
22 |
+
</p>
|
23 |
+
<center>
|
24 |
+
<img src="https://huggingface.co/spaces/kingabzpro/real-time-Urdu-ASR/resolve/main/Images/cover.jpg" alt="logo" width="550"/>
|
25 |
+
</center>
|
26 |
+
"""
|
27 |
+
|
28 |
+
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/Urdu-ASR-SOTA' alt='visitor badge'></center></p>"
|
29 |
+
|
30 |
+
|
31 |
+
gr.Interface(
|
32 |
+
fn=transcribe,
|
33 |
+
inputs=[
|
34 |
+
gr.inputs.Audio(source="microphone", type="filepath"),
|
35 |
+
"state"
|
36 |
+
],
|
37 |
+
outputs=[
|
38 |
+
"textbox",
|
39 |
+
"state"
|
40 |
+
],
|
41 |
+
title=title,
|
42 |
+
description=description,
|
43 |
+
article=article,
|
44 |
+
live=True).launch()
|
packages.txt
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
ffmpeg
|
requirements.txt
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
torch
|
2 |
+
transformers
|