mirror of
https://github.com/lllyasviel/Fooocus.git
synced 2026-08-16 13:13:16 +02:00
only make stop_button and skip_button interactive when rendering process starts
fix inconsistency in behaviour of stop_button and skip_button as it was possible to skip or stop other users processes while still being in queue
This commit is contained in:
@@ -31,7 +31,9 @@ def generate_clicked(*args):
|
|||||||
yield gr.update(visible=True, value=modules.html.make_progress_html(1, 'Waiting for task to start ...')), \
|
yield gr.update(visible=True, value=modules.html.make_progress_html(1, 'Waiting for task to start ...')), \
|
||||||
gr.update(visible=True, value=None), \
|
gr.update(visible=True, value=None), \
|
||||||
gr.update(visible=False, value=None), \
|
gr.update(visible=False, value=None), \
|
||||||
gr.update(visible=False)
|
gr.update(visible=False), \
|
||||||
|
gr.update(visible=True, interactive=True), \
|
||||||
|
gr.update(visible=True, interactive=True)
|
||||||
|
|
||||||
worker.async_tasks.append(task)
|
worker.async_tasks.append(task)
|
||||||
|
|
||||||
@@ -51,17 +53,23 @@ def generate_clicked(*args):
|
|||||||
yield gr.update(visible=True, value=modules.html.make_progress_html(percentage, title)), \
|
yield gr.update(visible=True, value=modules.html.make_progress_html(percentage, title)), \
|
||||||
gr.update(visible=True, value=image) if image is not None else gr.update(), \
|
gr.update(visible=True, value=image) if image is not None else gr.update(), \
|
||||||
gr.update(), \
|
gr.update(), \
|
||||||
gr.update(visible=False)
|
gr.update(visible=False), \
|
||||||
|
gr.update(visible=True), \
|
||||||
|
gr.update(visible=True)
|
||||||
if flag == 'results':
|
if flag == 'results':
|
||||||
yield gr.update(visible=True), \
|
yield gr.update(visible=True), \
|
||||||
gr.update(visible=True), \
|
gr.update(visible=True), \
|
||||||
gr.update(visible=True, value=product), \
|
gr.update(visible=True, value=product), \
|
||||||
gr.update(visible=False)
|
gr.update(visible=False), \
|
||||||
|
gr.update(visible=True), \
|
||||||
|
gr.update(visible=True)
|
||||||
if flag == 'finish':
|
if flag == 'finish':
|
||||||
yield gr.update(visible=False), \
|
yield gr.update(visible=False), \
|
||||||
gr.update(visible=False), \
|
gr.update(visible=False), \
|
||||||
gr.update(visible=False), \
|
gr.update(visible=False), \
|
||||||
gr.update(visible=True, value=product)
|
gr.update(visible=True, value=product), \
|
||||||
|
gr.update(visible=False), \
|
||||||
|
gr.update(visible=False)
|
||||||
finished = True
|
finished = True
|
||||||
|
|
||||||
execution_time = time.perf_counter() - execution_start_time
|
execution_time = time.perf_counter() - execution_start_time
|
||||||
@@ -437,10 +445,10 @@ with shared.gradio_root:
|
|||||||
ctrls += [outpaint_selections, inpaint_input_image]
|
ctrls += [outpaint_selections, inpaint_input_image]
|
||||||
ctrls += ip_ctrls
|
ctrls += ip_ctrls
|
||||||
|
|
||||||
generate_button.click(lambda: (gr.update(visible=True, interactive=True), gr.update(visible=True, interactive=True), gr.update(visible=False), []), outputs=[stop_button, skip_button, generate_button, gallery]) \
|
generate_button.click(lambda: (gr.update(visible=True, interactive=False), gr.update(visible=True, interactive=False), gr.update(visible=False), []), outputs=[stop_button, skip_button, generate_button, gallery]) \
|
||||||
.then(fn=refresh_seed, inputs=[seed_random, image_seed], outputs=image_seed) \
|
.then(fn=refresh_seed, inputs=[seed_random, image_seed], outputs=image_seed) \
|
||||||
.then(advanced_parameters.set_all_advanced_parameters, inputs=adps) \
|
.then(advanced_parameters.set_all_advanced_parameters, inputs=adps) \
|
||||||
.then(fn=generate_clicked, inputs=ctrls, outputs=[progress_html, progress_window, progress_gallery, gallery]) \
|
.then(fn=generate_clicked, inputs=ctrls, outputs=[progress_html, progress_window, progress_gallery, gallery, stop_button, skip_button]) \
|
||||||
.then(lambda: (gr.update(visible=True), gr.update(visible=False), gr.update(visible=False)), outputs=[generate_button, stop_button, skip_button]) \
|
.then(lambda: (gr.update(visible=True), gr.update(visible=False), gr.update(visible=False)), outputs=[generate_button, stop_button, skip_button]) \
|
||||||
.then(fn=lambda: None, _js='playNotification').then(fn=lambda: None, _js='refresh_grid_delayed')
|
.then(fn=lambda: None, _js='playNotification').then(fn=lambda: None, _js='refresh_grid_delayed')
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user