Spaces:
Runtime error
Runtime error
app
Browse files- app.py +27 -0
- packages.txt +2 -0
- requirements.txt +5 -0
app.py
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from transformers import pipeline
|
2 |
+
import gradio as gr
|
3 |
+
import time
|
4 |
+
|
5 |
+
asr = pipeline("automatic-speech-recognition", "../models/20220513-212939/_lm", device=0)
|
6 |
+
# asr = pipeline("automatic-speech-recognition", "YSU/aspram")
|
7 |
+
|
8 |
+
def transcribe(audio, state=""):
|
9 |
+
time.sleep(5)
|
10 |
+
text = asr(audio)["text"]
|
11 |
+
state += text + " "
|
12 |
+
print('chunk!')
|
13 |
+
return state, state
|
14 |
+
|
15 |
+
gr.Interface(
|
16 |
+
fn=transcribe,
|
17 |
+
inputs=[
|
18 |
+
gr.inputs.Audio(source="microphone", type="filepath"),
|
19 |
+
"state"
|
20 |
+
],
|
21 |
+
outputs=[
|
22 |
+
"textbox",
|
23 |
+
"state"
|
24 |
+
],
|
25 |
+
live=True,
|
26 |
+
css='body {background-color: rgba(240, 200, 192)}',
|
27 |
+
).launch()
|
packages.txt
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
ffmpeg
|
2 |
+
libsndfile1
|
requirements.txt
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
torch
|
2 |
+
transformers
|
3 |
+
librosa
|
4 |
+
pyctcdecode
|
5 |
+
pypi-kenlm
|