Spaces:
Sleeping
Sleeping
Commit
·
53fa185
1
Parent(s):
0876449
111
Browse files
app.py
CHANGED
@@ -1,17 +1,24 @@
|
|
1 |
import gradio as gr
|
|
|
|
|
2 |
|
3 |
-
|
4 |
-
# Placeholder function to process the image
|
5 |
-
# For now, it just returns the image as is
|
6 |
-
return image
|
7 |
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
)
|
15 |
|
16 |
-
|
17 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
+
from transformers import pipeline
|
3 |
+
import time
|
4 |
|
5 |
+
pipe = pipeline("automatic-speech-recognition")
|
|
|
|
|
|
|
6 |
|
7 |
+
def transcribe(audio, state=""):
|
8 |
+
print(audio)
|
9 |
+
time.sleep(2)
|
10 |
+
text = pipe(audio)["text"]
|
11 |
+
state += text + " "
|
12 |
+
return state, state
|
|
|
13 |
|
14 |
+
|
15 |
+
with gr.Blocks() as demo:
|
16 |
+
state = gr.State(value="")
|
17 |
+
with gr.Row():
|
18 |
+
with gr.Column():
|
19 |
+
audio = gr.Audio(source="microphone", type="filepath")
|
20 |
+
with gr.Column():
|
21 |
+
textbox = gr.Textbox()
|
22 |
+
audio.stream(fn=transcribe, inputs=[audio, state], outputs=[textbox, state])
|
23 |
+
|
24 |
+
demo.launch(debug=True)
|