From 84710c4d2bfc607d4b0c415ebc41cab6498e354b Mon Sep 17 00:00:00 2001 From: NR <6409357+nickrenwick@users.noreply.github.com> Date: Thu, 28 Aug 2025 07:09:35 +0100 Subject: [PATCH] Add immediate UI update for Generate and Stop buttons (#18) ### Summary The Stop button previously appeared only after the backend generation job actually started, leaving users with no cancel affordance while a request sat in the queue. This PR makes the Stop button visible immediately after clicking **Generate Podcast**. ### Change Adds a single non-queued `.then` step in the click event chain that hides the Generate button and shows the Stop button instantly, before the queued job begins processing. --- demo/gradio_demo.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/demo/gradio_demo.py b/demo/gradio_demo.py index 3a703a8..54a175d 100644 --- a/demo/gradio_demo.py +++ b/demo/gradio_demo.py @@ -992,6 +992,11 @@ Or paste text directly and it will auto-assign speakers.""", inputs=[], outputs=[audio_output, complete_audio_output], queue=False + ).then( # Immediate UI update to hide Generate, show Stop (non-queued) + fn=lambda: (gr.update(visible=False), gr.update(visible=True)), + inputs=[], + outputs=[generate_btn, stop_btn], + queue=False ).then( fn=generate_podcast_wrapper, inputs=[num_speakers, script_input] + speaker_selections + [cfg_scale],