Spaces:
Runtime error
Runtime error
update gradio
Browse files
README.md
CHANGED
|
@@ -4,7 +4,7 @@ emoji: π
|
|
| 4 |
colorFrom: yellow
|
| 5 |
colorTo: purple
|
| 6 |
sdk: gradio
|
| 7 |
-
sdk_version:
|
| 8 |
app_file: app.py
|
| 9 |
pinned: false
|
| 10 |
license: apache-2.0
|
|
|
|
| 4 |
colorFrom: yellow
|
| 5 |
colorTo: purple
|
| 6 |
sdk: gradio
|
| 7 |
+
sdk_version: 5.0.0b3
|
| 8 |
app_file: app.py
|
| 9 |
pinned: false
|
| 10 |
license: apache-2.0
|
app.py
CHANGED
|
@@ -1,25 +1,23 @@
|
|
| 1 |
-
import numpy as np
|
| 2 |
-
|
| 3 |
import gradio as gr
|
| 4 |
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
|
| 9 |
-
|
| 10 |
-
sources=["microphone"],
|
| 11 |
-
waveform_options=gr.WaveformOptions(
|
| 12 |
-
waveform_color="#01C6FF",
|
| 13 |
-
waveform_progress_color="#0066B4",
|
| 14 |
-
skip_length=2,
|
| 15 |
-
show_controls=False,
|
| 16 |
-
),
|
| 17 |
-
)
|
| 18 |
-
demo = gr.Interface(
|
| 19 |
-
fn=reverse_audio,
|
| 20 |
-
inputs=input_audio,
|
| 21 |
-
outputs="audio"
|
| 22 |
-
)
|
| 23 |
|
| 24 |
if __name__ == "__main__":
|
| 25 |
-
demo.launch()
|
|
|
|
|
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
|
| 3 |
+
t = "the big blue " * 5
|
| 4 |
+
i = 0
|
| 5 |
+
|
| 6 |
+
def transcribe(audio: str, state: str):
|
| 7 |
+
global i
|
| 8 |
+
next_chunk = t[i:i+1]
|
| 9 |
+
i += 1
|
| 10 |
+
state += " " + next_chunk
|
| 11 |
+
return audio, state
|
| 12 |
+
|
| 13 |
+
with gr.Blocks() as demo:
|
| 14 |
+
gr.Markdown("# New Audio Streaming In π€")
|
| 15 |
+
inp = gr.Audio(sources=["microphone"], type="filepath")
|
| 16 |
+
out = gr.Audio(type="filepath", autoplay=True)
|
| 17 |
+
transcription = gr.State(value="")
|
| 18 |
+
clear = gr.Button("Clear")
|
| 19 |
|
| 20 |
+
inp.stream(transcribe, [inp, transcription], [out, transcription], time_limit=10, stream_every=0.5)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
|
| 22 |
if __name__ == "__main__":
|
| 23 |
+
demo.launch()
|