I want to be able to call to a function when the button of “stop recording” is pressed.
I have the following simple code:
import gradio as gr def handle_streaming(stream_in): print(f" Got New Samples") def stop_streaming(): print("Streaming has stopped") if __name__ == "__main__": with gr.Blocks(theme=gr.themes.Glass()) as demo: stream_input = gr.Audio(source="microphone") stream_input.stream(fn = handle_streaming, inputs = [stream_input], outputs = , every = 1) demo.queue().launch(share=False, debug=False)
How can I call to my function
stop_streaming, when the button:
is pressed ?