Spaces:
Runtime error
Runtime error
add app
Browse files- app.py +23 -0
- packages.txt +1 -0
- requirements.txt +3 -0
app.py
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from transformers import pipeline
|
| 2 |
+
import gradio as gr
|
| 3 |
+
import time
|
| 4 |
+
|
| 5 |
+
p = pipeline("automatic-speech-recognition", model="indonesian-nlp/wav2vec2-indonesian-javanese-sundanese")
|
| 6 |
+
|
| 7 |
+
def transcribe(audio, state=""):
|
| 8 |
+
time.sleep(2)
|
| 9 |
+
text = p(audio)["text"]
|
| 10 |
+
state += text + " "
|
| 11 |
+
return state, state
|
| 12 |
+
|
| 13 |
+
gr.Interface(
|
| 14 |
+
fn=transcribe,
|
| 15 |
+
inputs=[
|
| 16 |
+
gr.inputs.Audio(source="microphone", type="filepath"),
|
| 17 |
+
"state"
|
| 18 |
+
],
|
| 19 |
+
outputs=[
|
| 20 |
+
"textbox",
|
| 21 |
+
"state"
|
| 22 |
+
],
|
| 23 |
+
live=True).launch()
|
packages.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
ffmpeg
|
requirements.txt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
torch
|
| 2 |
+
transformers
|
| 3 |
+
|