fire checkbox change event (#77)

This commit is contained in:
Won-Kyu Park
2023-10-13 09:58:15 -07:00
committed by GitHub
parent 4a3c7a86e0
commit 3889ebc8e3
2 changed files with 19 additions and 2 deletions
+5 -2
View File
@@ -42,6 +42,8 @@ class Script(scripts.Script):
def vis_change(isVis):
return {"visible": isVis, "__type__": "update"}
# "Dynamic Thresholding (CFG Scale Fix)"
dtrue = gr.Checkbox(value=True, visible=False)
dfalse = gr.Checkbox(value=False, visible=False)
with gr.Accordion("Dynamic Thresholding (CFG Scale Fix)", open=False, elem_id="dynthres_" + ("img2img" if is_img2img else "txt2img")):
with gr.Row():
enabled = gr.Checkbox(value=False, label="Enable Dynamic Thresholding (CFG Scale Fix)", elem_classes=["dynthres-enabled"])
@@ -68,8 +70,9 @@ class Script(scripts.Script):
cfg_mode.change(shouldShowSchedulerValue, inputs=[cfg_mode, mimic_mode], outputs=[sched_val, mimic_scale_min, cfg_scale_min])
mimic_mode.change(shouldShowSchedulerValue, inputs=[cfg_mode, mimic_mode], outputs=[sched_val, mimic_scale_min, cfg_scale_min])
enabled.change(
fn=lambda x: {"visible": x, "__type__": "update"},
inputs=[enabled],
_js="dynthres_update_enabled",
fn=lambda x, y: {"visible": x, "__type__": "update"},
inputs=[enabled, dtrue if is_img2img else dfalse],
outputs=[accordion],
show_progress = False)
self.infotext_fields = (