@@ -489,6 +489,25 @@ def create_ui():
489
489
cfg_scale = gr .Slider (minimum = 1.0 , maximum = 30.0 , step = 0.1 , label = 'CFG Scale' , value = 7.0 , elem_id = "txt2img_cfg_scale" )
490
490
cfg_scale .change (lambda x : gr .update (interactive = (x != 1 )), inputs = [cfg_scale ], outputs = [toprow .negative_prompt ], queue = False , show_progress = False )
491
491
492
+ hr_use_different_cfg .change (
493
+ fn = None ,
494
+ _js = "toggleUseDifferentHRCFGScale" ,
495
+ inputs = [hr_use_different_cfg , distilled_cfg_scale , cfg_scale ],
496
+ outputs = [hr_distilled_cfg , hr_cfg ],
497
+ )
498
+ distilled_cfg_scale .change (
499
+ fn = None ,
500
+ _js = "syncHRCFGScale" ,
501
+ inputs = [hr_use_different_cfg , distilled_cfg_scale ],
502
+ outputs = [hr_distilled_cfg ],
503
+ )
504
+ cfg_scale .change (
505
+ fn = None ,
506
+ _js = "syncHRCFGScale" ,
507
+ inputs = [hr_use_different_cfg , cfg_scale ],
508
+ outputs = [hr_cfg ],
509
+ )
510
+
492
511
elif category == "checkboxes" :
493
512
with FormRow (elem_classes = "checkboxes-row" , variant = "compact" ):
494
513
restore_faces = gr .Checkbox (label = 'Restore faces' , value = False , visible = len (shared .face_restorers ) > 1 , elem_id = "txt2img_restore_faces" )
@@ -540,8 +559,9 @@ def create_ui():
540
559
_js = "monitorThisParam('tab_txt2img', 'modules.txt2img.txt2img', 'hr_resize_y')" )
541
560
542
561
with FormRow (elem_id = "txt2img_hires_fix_row_cfg" , variant = "compact" ):
543
- hr_distilled_cfg = gr .Slider (minimum = 0.0 , maximum = 30.0 , step = 0.1 , label = "Hires Distilled CFG Scale" , value = 3.5 , elem_id = "txt2img_hr_distilled_cfg" )
544
- hr_cfg = gr .Slider (minimum = 1.0 , maximum = 30.0 , step = 0.1 , label = "Hires CFG Scale" , value = 7.0 , elem_id = "txt2img_hr_cfg" )
562
+ hr_distilled_cfg = gr .Slider (minimum = 0.0 , maximum = 30.0 , step = 0.1 , label = "Hires Distilled CFG Scale" , value = 3.5 , elem_id = "txt2img_hr_distilled_cfg" , interactive = False )
563
+ hr_cfg = gr .Slider (minimum = 1.0 , maximum = 30.0 , step = 0.1 , label = "Hires CFG Scale" , value = 7.0 , elem_id = "txt2img_hr_cfg" , interactive = False )
564
+ hr_use_different_cfg = gr .Checkbox (label = "Use different CFG scale" , value = False , elem_id = "txt2img_hr_use_different_cfg" )
545
565
546
566
with FormRow (elem_id = "txt2img_hires_fix_row3" , variant = "compact" , visible = shared .opts .hires_fix_show_sampler ) as hr_checkpoint_container :
547
567
hr_checkpoint_name = gr .Dropdown (label = 'Hires Checkpoint' , elem_id = "hr_checkpoint" , choices = ["Use same checkpoint" ], value = "Use same checkpoint" , scale = 2 , multiselect = False )
0 commit comments