Spaces:
Sleeping
Sleeping
Srivatsa Kundurthy
commited on
Commit
•
4ca677f
1
Parent(s):
dfa4663
update inference
Browse files- app.py +11 -1
- requirements.txt +2 -0
app.py
CHANGED
@@ -1,8 +1,18 @@
|
|
1 |
import gradio as gr
|
|
|
2 |
|
3 |
-
|
4 |
|
|
|
5 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
|
7 |
mic_mode = gr.Interface(
|
8 |
fn=inference,
|
|
|
1 |
import gradio as gr
|
2 |
+
from transformers import pipeline
|
3 |
|
4 |
+
wav2_ft = pipeline("automatic-speech-recognition",model='sanchit-gandhi/wav2vec2-large-tedlium',device=device,trust_remote_code=True)
|
5 |
|
6 |
+
app = gr.Blocks()
|
7 |
|
8 |
+
def inference(path):
|
9 |
+
out = wav2_ft(
|
10 |
+
path,
|
11 |
+
max_new_tokens=256,
|
12 |
+
chunk_length_s=30,
|
13 |
+
batch_size=8,
|
14 |
+
)
|
15 |
+
return out['text']
|
16 |
|
17 |
mic_mode = gr.Interface(
|
18 |
fn=inference,
|
requirements.txt
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
gradio
|
2 |
+
transformers
|