Vishnu-add
commited on
Commit
•
9a49875
1
Parent(s):
e2d02df
Upload 35 files
Browse files- .gitattributes +6 -0
- README.md +22 -4
- Samples/3.mp3 +0 -0
- Samples/Bengali_1.wav +0 -0
- Samples/Bengali_2.wav +0 -0
- Samples/Gujarati_1.wav +0 -0
- Samples/Gujarati_2.wav +3 -0
- Samples/Hindi_1.mp3 +0 -0
- Samples/Hindi_2.mp3 +0 -0
- Samples/Hindi_3.mp3 +0 -0
- Samples/Hindi_4.mp3 +0 -0
- Samples/Hindi_5.mp3 +0 -0
- Samples/Malayalam_1.wav +0 -0
- Samples/Malayalam_2.wav +0 -0
- Samples/Malayalam_3.wav +0 -0
- Samples/Marathi_1.mp3 +0 -0
- Samples/Marathi_2.mp3 +0 -0
- Samples/Marathi_3.mp3 +0 -0
- Samples/Montreal Vacation Travel Guide Expedia.mp3 +3 -0
- Samples/Nepal_1.mp3 +0 -0
- Samples/Nepal_2.mp3 +0 -0
- Samples/Nepal_3.mp3 +0 -0
- Samples/Que es TED y TEDx.mp3 +3 -0
- Samples/Tamil_1.mp3 +0 -0
- Samples/Tamil_2.mp3 +0 -0
- Samples/Telugu_1.wav +0 -0
- Samples/Telugu_2.wav +3 -0
- Samples/Telugu_3.wav +0 -0
- Samples/climate ex short.wav +0 -0
- Samples/emp2.wav +3 -0
- Samples/ted_short.wav +0 -0
- Samples/test_mixture.wav +3 -0
- Samples/test_mixture1.wav +0 -0
- app.py +44 -0
- requirements.txt +5 -0
.gitattributes
CHANGED
@@ -33,3 +33,9 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
36 |
+
Samples/emp2.wav filter=lfs diff=lfs merge=lfs -text
|
37 |
+
Samples/Montreal[[:space:]]Vacation[[:space:]]Travel[[:space:]]Guide[[:space:]][[:space:]]Expedia.mp3 filter=lfs diff=lfs merge=lfs -text
|
38 |
+
Samples/Que[[:space:]]es[[:space:]]TED[[:space:]]y[[:space:]]TEDx.mp3 filter=lfs diff=lfs merge=lfs -text
|
39 |
+
Samples/test_mixture.wav filter=lfs diff=lfs merge=lfs -text
|
40 |
+
Samples/Gujarati_2.wav filter=lfs diff=lfs merge=lfs -text
|
41 |
+
Samples/Telugu_2.wav filter=lfs diff=lfs merge=lfs -text
|
README.md
CHANGED
@@ -1,13 +1,31 @@
|
|
1 |
---
|
2 |
title: Ai4bharat Indicwave2vec Models
|
3 |
-
emoji:
|
4 |
-
colorFrom:
|
5 |
-
colorTo:
|
6 |
sdk: gradio
|
7 |
-
sdk_version: 4.
|
8 |
app_file: app.py
|
9 |
pinned: false
|
10 |
license: mit
|
11 |
---
|
12 |
|
13 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
title: Ai4bharat Indicwave2vec Models
|
3 |
+
emoji: ⚡
|
4 |
+
colorFrom: pink
|
5 |
+
colorTo: indigo
|
6 |
sdk: gradio
|
7 |
+
sdk_version: 4.0.2
|
8 |
app_file: app.py
|
9 |
pinned: false
|
10 |
license: mit
|
11 |
---
|
12 |
|
13 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
14 |
+
|
15 |
+
|
16 |
+
|
17 |
+
Gujarati_2:
|
18 |
+
|
19 |
+
અનુકૂલન કરવું એ અનુકૂલન થવાની સ્થિતિ છે આ તબક્કો સજીવને તેના વસવાટોમાં જીવવા અને પ્રજનન કરવા સક્ષમ બનાવે છે
|
20 |
+
|
21 |
+
Gujarati_1:
|
22 |
+
જૈન તત્વ જ્ઞાનમાં પાંચ પ્રકારના અણુવ્રતો બતાવ્યાં છે.
|
23 |
+
|
24 |
+
Malayalam_1:
|
25 |
+
അത്തരം ഏറ്റുപറയൽ അനുരഞ്ജനപ്രക്രിയയുടെ ഭാഗമാണ്
|
26 |
+
|
27 |
+
Malayalam_2:
|
28 |
+
ആൺപൂച്ചയുടെ ലിംഗത്തിൽ പിറകിലേയ്ക്ക് നിൽക്കുന്ന മുളളുകൾ ഉണ്ടാകും
|
29 |
+
|
30 |
+
Malayalam_3:
|
31 |
+
ആക്രമണമുണ്ടായ ഉടൻ ഒട്ടേറെപ്പേർ പ്രാണരക്ഷാർഥം ഏറ്റവും മുകളിലത്തെ നിലയിലേക്ക് ഓടിക്കയറി
|
Samples/3.mp3
ADDED
Binary file (36.8 kB). View file
|
|
Samples/Bengali_1.wav
ADDED
Binary file (129 kB). View file
|
|
Samples/Bengali_2.wav
ADDED
Binary file (129 kB). View file
|
|
Samples/Gujarati_1.wav
ADDED
Binary file (434 kB). View file
|
|
Samples/Gujarati_2.wav
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:3d087ac4bc15ddccecbbded4c8fdd2c9501bd8e08c6550f9c03ec46bd2df64da
|
3 |
+
size 1597484
|
Samples/Hindi_1.mp3
ADDED
Binary file (36.5 kB). View file
|
|
Samples/Hindi_2.mp3
ADDED
Binary file (24.6 kB). View file
|
|
Samples/Hindi_3.mp3
ADDED
Binary file (39.8 kB). View file
|
|
Samples/Hindi_4.mp3
ADDED
Binary file (49.5 kB). View file
|
|
Samples/Hindi_5.mp3
ADDED
Binary file (52.5 kB). View file
|
|
Samples/Malayalam_1.wav
ADDED
Binary file (762 kB). View file
|
|
Samples/Malayalam_2.wav
ADDED
Binary file (729 kB). View file
|
|
Samples/Malayalam_3.wav
ADDED
Binary file (555 kB). View file
|
|
Samples/Marathi_1.mp3
ADDED
Binary file (30.3 kB). View file
|
|
Samples/Marathi_2.mp3
ADDED
Binary file (55.1 kB). View file
|
|
Samples/Marathi_3.mp3
ADDED
Binary file (60.5 kB). View file
|
|
Samples/Montreal Vacation Travel Guide Expedia.mp3
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:bc5148bfd0aca841584c6120c9b02c4c3d9aada2e9b015827a7869803b6471cb
|
3 |
+
size 8058808
|
Samples/Nepal_1.mp3
ADDED
Binary file (12.8 kB). View file
|
|
Samples/Nepal_2.mp3
ADDED
Binary file (31.4 kB). View file
|
|
Samples/Nepal_3.mp3
ADDED
Binary file (30.3 kB). View file
|
|
Samples/Que es TED y TEDx.mp3
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:120a8f591bec8715dea618a14bf0538ec03444aaf875994bac0d8a1506f2ffdc
|
3 |
+
size 1852114
|
Samples/Tamil_1.mp3
ADDED
Binary file (57.9 kB). View file
|
|
Samples/Tamil_2.mp3
ADDED
Binary file (49.3 kB). View file
|
|
Samples/Telugu_1.wav
ADDED
Binary file (500 kB). View file
|
|
Samples/Telugu_2.wav
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:ccee4c1d338d4d6fc96dfca5f48ecac3d9b9517e44f0302037fe46304e9e76b0
|
3 |
+
size 1122348
|
Samples/Telugu_3.wav
ADDED
Binary file (950 kB). View file
|
|
Samples/climate ex short.wav
ADDED
Binary file (308 kB). View file
|
|
Samples/emp2.wav
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:133ac69ac8a7d99f1fe92b7dbd810d7f4e44cd4f282179aa8c5d83183e64ad61
|
3 |
+
size 1122066
|
Samples/ted_short.wav
ADDED
Binary file (765 kB). View file
|
|
Samples/test_mixture.wav
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:7126269f058724336d28bf6e82fa14b7030de321dbafa48c9fa20884d35dab9d
|
3 |
+
size 1546250
|
Samples/test_mixture1.wav
ADDED
Binary file (603 kB). View file
|
|
app.py
ADDED
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import time
|
2 |
+
from transformers import pipeline
|
3 |
+
import gradio as gr
|
4 |
+
import numpy as np
|
5 |
+
import librosa
|
6 |
+
|
7 |
+
transcriber_hindi = pipeline("automatic-speech-recognition", model="ai4bharat/indicwav2vec-hindi")
|
8 |
+
transcriber_bengali = pipeline("automatic-speech-recognition", model="ai4bharat/indicwav2vec_v1_bengali")
|
9 |
+
transcriber_odia = pipeline("automatic-speech-recognition", model="ai4bharat/indicwav2vec-odia")
|
10 |
+
transcriber_gujarati = pipeline("automatic-speech-recognition", model="ai4bharat/indicwav2vec_v1_gujarati")
|
11 |
+
# transcriber_telugu = pipeline("automatic-speech-recognition", model="ai4bharat/indicwav2vec_v1_telugu")
|
12 |
+
# transcriber_sinhala = pipeline("automatic-speech-recognition", model="ai4bharat/indicwav2vec_v1_sinhala")
|
13 |
+
# transcriber_tamil = pipeline("automatic-speech-recognition", model="ai4bharat/indicwav2vec_v1_tamil")
|
14 |
+
# transcriber_nepali = pipeline("automatic-speech-recognition", model="ai4bharat/indicwav2vec_v1_nepali")
|
15 |
+
# transcriber_marathi = pipeline("automatic-speech-recognition", model="ai4bharat/indicwav2vec_v1_marathi")
|
16 |
+
|
17 |
+
languages = ["hindi","bengali","odia","gujarati"]
|
18 |
+
|
19 |
+
def resample_to_16k(audio, orig_sr):
|
20 |
+
y_resampled = librosa.resample(y=audio, orig_sr=orig_sr, target_sr=16000)
|
21 |
+
return y_resampled
|
22 |
+
|
23 |
+
def transcribe(audio,lang="hindi"):
|
24 |
+
sr,y = audio
|
25 |
+
y = y.astype(np.float32)
|
26 |
+
y/= np.max(np.abs(y))
|
27 |
+
y_resampled = resample_to_16k(y,sr)
|
28 |
+
if lang not in languages:
|
29 |
+
return "No Model","So Stay tuned!"
|
30 |
+
pipe= eval(f'transcriber_{lang}')
|
31 |
+
start_time = time.time()
|
32 |
+
trans = pipe(y_resampled)
|
33 |
+
end_time = time.time()
|
34 |
+
|
35 |
+
return trans["text"],(end_time-start_time)
|
36 |
+
|
37 |
+
demo = gr.Interface(
|
38 |
+
transcribe,
|
39 |
+
inputs=["microphone",gr.Radio(["hindi","bengali","odia","gujarati"],value="hindi")],
|
40 |
+
# inputs=["microphone",gr.Radio(["hindi","bengali","odia","gujarati","telugu","sinhala","tamil","nepali","marathi"],value="hindi")],
|
41 |
+
outputs=["text","text"],
|
42 |
+
examples=[["./Samples/Hindi_1.mp3","hindi"],["./Samples/Hindi_2.mp3","hindi"],["./Samples/Hindi_3.mp3","hindi"],["./Samples/Hindi_4.mp3","hindi"],["./Samples/Hindi_5.mp3","hindi"],["./Samples/Tamil_2.mp3","hindi"],["./Samples/climate ex short.wav","hindi"],["./Samples/Gujarati_1.wav","gujarati"],["./Samples/Gujarati_2.wav","gujarati"],["./Samples/Bengali_1.wav","bengali"],["./Samples/Bengali_2.wav","bengali"]])
|
43 |
+
# examples=[["./Samples/Hindi_1.mp3","hindi"],["./Samples/Hindi_2.mp3","hindi"],["./Samples/Tamil_1.mp3","tamil"],["./Samples/Tamil_2.mp3","hindi"],["./Samples/Nepal_1.mp3","nepali"],["./Samples/Nepal_2.mp3","nepali"],["./Samples/Marathi_1.mp3","marathi"],["./Samples/Marathi_2.mp3","marathi"],["./Samples/climate ex short.wav","hindi"]])
|
44 |
+
demo.launch()
|
requirements.txt
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
transformers[sentencepiece]
|
2 |
+
torch
|
3 |
+
torchaudio
|
4 |
+
librosa
|
5 |
+
tensorflow
|