Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -12,16 +12,14 @@ def add_to_stream(audio, instream):
|
|
12 |
ret = (audio[0], np.concatenate((instream[1], audio[1])))
|
13 |
return ret, ret
|
14 |
|
15 |
-
|
16 |
with gr.Blocks() as demo:
|
17 |
-
inp = gr.Audio(
|
18 |
-
out = gr.Audio()
|
19 |
stream = gr.State()
|
20 |
clear = gr.Button("Clear")
|
21 |
|
22 |
inp.stream(add_to_stream, [inp, stream], [out, stream])
|
23 |
clear.click(lambda: [None, None, None], None, [inp, out, stream])
|
24 |
|
25 |
-
|
26 |
if __name__ == "__main__":
|
27 |
-
demo.launch()
|
|
|
12 |
ret = (audio[0], np.concatenate((instream[1], audio[1])))
|
13 |
return ret, ret
|
14 |
|
|
|
15 |
with gr.Blocks() as demo:
|
16 |
+
inp = gr.Audio(source="microphone", streaming=True) # Enable streaming mode
|
17 |
+
out = gr.Audio(streaming=True) # Enable streaming output
|
18 |
stream = gr.State()
|
19 |
clear = gr.Button("Clear")
|
20 |
|
21 |
inp.stream(add_to_stream, [inp, stream], [out, stream])
|
22 |
clear.click(lambda: [None, None, None], None, [inp, out, stream])
|
23 |
|
|
|
24 |
if __name__ == "__main__":
|
25 |
+
demo.launch()
|