Spaces:
Runtime error
Runtime error
Commit
·
297adbe
1
Parent(s):
bdb3001
Modified app and requirements.txt
Browse files- app.py +20 -4
- requirements.txt +3 -0
app.py
CHANGED
|
@@ -1,9 +1,25 @@
|
|
|
|
|
| 1 |
import gradio as gr
|
|
|
|
| 2 |
|
|
|
|
| 3 |
|
| 4 |
-
def greet(name):
|
| 5 |
-
return "Hello " + name + "!!"
|
| 6 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
|
| 8 |
-
|
| 9 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from transformers import pipeline
|
| 2 |
import gradio as gr
|
| 3 |
+
import time
|
| 4 |
|
| 5 |
+
p = pipeline("automatic-speech-recognition")
|
| 6 |
|
|
|
|
|
|
|
| 7 |
|
| 8 |
+
def transcribe(audio, state=""):
|
| 9 |
+
time.sleep(2)
|
| 10 |
+
text = p(audio)["text"]
|
| 11 |
+
state += text + " "
|
| 12 |
+
return state, state
|
| 13 |
|
| 14 |
+
|
| 15 |
+
gr.Interface(
|
| 16 |
+
fn=transcribe,
|
| 17 |
+
inputs=[
|
| 18 |
+
gr.Audio(source="microphone", type="filepath", streaming=True),
|
| 19 |
+
"state"
|
| 20 |
+
],
|
| 21 |
+
outputs=[
|
| 22 |
+
"textbox",
|
| 23 |
+
"state"
|
| 24 |
+
],
|
| 25 |
+
live=True).launch()
|
requirements.txt
CHANGED
|
@@ -1 +1,4 @@
|
|
| 1 |
gradio==3.16.2
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
gradio==3.16.2
|
| 2 |
+
transformers
|
| 3 |
+
torch
|
| 4 |
+
deepspeech==0.8.2
|