add skip button (#616)
This commit is contained in:
parent
0723c2fa52
commit
c275434c59
@ -1 +1 @@
|
||||
version = '2.1.33'
|
||||
version = '2.1.34'
|
||||
|
@ -542,8 +542,12 @@ def worker():
|
||||
|
||||
results += imgs
|
||||
except comfy.model_management.InterruptProcessingException as e:
|
||||
print('User stopped')
|
||||
break
|
||||
if shared.last_stop == 'skip':
|
||||
print('User skipped')
|
||||
continue
|
||||
else:
|
||||
print('User stopped')
|
||||
break
|
||||
|
||||
execution_time = time.perf_counter() - execution_start_time
|
||||
print(f'Generating and saving time: {execution_time:.2f} seconds')
|
||||
|
@ -72,6 +72,10 @@ progress::after {
|
||||
height: 80px !important;
|
||||
}
|
||||
|
||||
.type_row_half{
|
||||
height: 32px !important;
|
||||
}
|
||||
|
||||
.scroll-hide{
|
||||
resize: none !important;
|
||||
}
|
||||
|
19
webui.py
19
webui.py
@ -57,14 +57,23 @@ with shared.gradio_root:
|
||||
prompt = gr.Textbox(show_label=False, placeholder="Type prompt here.", container=False, autofocus=True, elem_classes='type_row', lines=1024)
|
||||
with gr.Column(scale=0.15, min_width=0):
|
||||
run_button = gr.Button(label="Generate", value="Generate", elem_classes='type_row', visible=True)
|
||||
stop_button = gr.Button(label="Stop", value="Stop", elem_classes='type_row', visible=False)
|
||||
skip_button = gr.Button(label="Skip", value="Skip", elem_classes='type_row_half', visible=False)
|
||||
stop_button = gr.Button(label="Stop", value="Stop", elem_classes='type_row_half', visible=False)
|
||||
|
||||
def stop_clicked():
|
||||
import comfy.model_management as model_management
|
||||
shared.last_stop = 'stop'
|
||||
model_management.interrupt_current_processing()
|
||||
return gr.update(interactive=False)
|
||||
return [gr.update(interactive=False)] * 2
|
||||
|
||||
stop_button.click(stop_clicked, outputs=stop_button, queue=False)
|
||||
def skip_clicked():
|
||||
import comfy.model_management as model_management
|
||||
shared.last_stop = 'skip'
|
||||
model_management.interrupt_current_processing()
|
||||
return
|
||||
|
||||
stop_button.click(stop_clicked, outputs=[skip_button, stop_button], queue=False)
|
||||
skip_button.click(skip_clicked, queue=False)
|
||||
with gr.Row(elem_classes='advanced_check_row'):
|
||||
input_image_checkbox = gr.Checkbox(label='Input Image', value=False, container=False, elem_classes='min_check')
|
||||
advanced_checkbox = gr.Checkbox(label='Advanced', value=False, container=False, elem_classes='min_check')
|
||||
@ -308,11 +317,11 @@ with shared.gradio_root:
|
||||
ctrls += [outpaint_selections, inpaint_input_image]
|
||||
ctrls += ip_ctrls
|
||||
|
||||
run_button.click(lambda: (gr.update(visible=True, interactive=True), gr.update(visible=False), []), outputs=[stop_button, run_button, gallery])\
|
||||
run_button.click(lambda: (gr.update(visible=True, interactive=True), gr.update(visible=True, interactive=True), gr.update(visible=False), []), outputs=[stop_button, skip_button, run_button, gallery])\
|
||||
.then(fn=refresh_seed, inputs=[seed_random, image_seed], outputs=image_seed)\
|
||||
.then(advanced_parameters.set_all_advanced_parameters, inputs=adps)\
|
||||
.then(fn=generate_clicked, inputs=ctrls, outputs=[progress_html, progress_window, gallery])\
|
||||
.then(lambda: (gr.update(visible=True), gr.update(visible=False)), outputs=[run_button, stop_button])
|
||||
.then(lambda: (gr.update(visible=True), gr.update(visible=False), gr.update(visible=False)), outputs=[run_button, stop_button, skip_button])
|
||||
|
||||
|
||||
shared.gradio_root.launch(
|
||||
|
Loading…
Reference in New Issue
Block a user