kmknair commited on
Commit
2c3f8ff
1 Parent(s): 8b700f8
Files changed (5) hide show
  1. .gitignore +3 -0
  2. README.md +1 -1
  3. app.py +26 -0
  4. packages.txt +1 -0
  5. requirements.txt +2 -0
.gitignore ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ __pycache__/*
2
+ .DS_Store
3
+ .vscode/*%
README.md CHANGED
@@ -9,4 +9,4 @@ app_file: app.py
9
  pinned: false
10
  ---
11
 
12
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
9
  pinned: false
10
  ---
11
 
12
+ ## XLSR Wav2Vec2 real time ASR demo in Tamil
app.py ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from transformers import pipeline
3
+ import time
4
+
5
+ # p = pipeline("automatic-speech-recognition", model="/Users/mkesavan/aidev/speechAI-trials/xlsr-wave2vec/wav2vec2-large-xls-r-300m-tamil-colab/checkpoint-1600")
6
+
7
+ p = pipeline("automatic-speech-recognition", model="kmknair/wav2vec2-xlsr-tamil")
8
+
9
+ def transcribe(audio, state=""):
10
+ time.sleep(2)
11
+ text = p(audio)["text"]
12
+ state += text + " "
13
+ return state, state
14
+
15
+
16
+ gr.Interface(
17
+ fn=transcribe,
18
+ inputs=[
19
+ gr.Audio(source="microphone", type="filepath", streaming=True),
20
+ "state"
21
+ ],
22
+ outputs=[
23
+ "textbox",
24
+ "state"
25
+ ],
26
+ live=True).launch()
packages.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ ffmpeg
requirements.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ torch
2
+ transformers