Spaces:
Sleeping
Sleeping
GuillermoPuma
commited on
Commit
·
22c83b7
1
Parent(s):
2587a0c
add files
Browse files- requirements.txt +2 -0
- app.py +21 -0
- packages.txt +1 -0
requirements.txt
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
torch
|
| 2 |
+
transformers
|
app.py
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from transformers import pipeline
|
| 2 |
+
import gradio as gr
|
| 3 |
+
|
| 4 |
+
p = pipeline("automatic-speech-recognition")
|
| 5 |
+
|
| 6 |
+
def transcribe(audio, state=""):
|
| 7 |
+
text = p(audio)["text"]
|
| 8 |
+
state += text + " "
|
| 9 |
+
return state, state
|
| 10 |
+
|
| 11 |
+
gr.Interface(
|
| 12 |
+
fn=transcribe,
|
| 13 |
+
inputs=[
|
| 14 |
+
gr.inputs.Audio(source="microphone", type="filepath"),
|
| 15 |
+
"state"
|
| 16 |
+
],
|
| 17 |
+
outputs=[
|
| 18 |
+
"textbox",
|
| 19 |
+
"state"
|
| 20 |
+
],
|
| 21 |
+
live=True).launch()
|
packages.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
ffmpeg
|