Spaces:
Runtime error
Runtime error
| import gradio as gr | |
| t = "the big blue " * 5 | |
| i = 0 | |
| def transcribe(audio: str, state: str): | |
| global i | |
| next_chunk = t[i:i+1] | |
| i += 1 | |
| state += " " + next_chunk | |
| return audio, state | |
| with gr.Blocks() as demo: | |
| gr.Markdown("# New Audio Streaming In π€") | |
| inp = gr.Audio(sources=["microphone"], type="filepath") | |
| out = gr.Audio(type="filepath", autoplay=True) | |
| transcription = gr.State(value="") | |
| clear = gr.Button("Clear") | |
| inp.stream(transcribe, [inp, transcription], [out, transcription], time_limit=10, stream_every=1) | |
| if __name__ == "__main__": | |
| demo.launch() |