From 81be357925241359e6d40dd603923182faa8a2da Mon Sep 17 00:00:00 2001 From: Andray Date: Sun, 17 Mar 2024 14:51:19 +0400 Subject: [PATCH] hide limit target resolution under option --- modules/shared_options.py | 1 + scripts/postprocessing_upscale.py | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/modules/shared_options.py b/modules/shared_options.py index fc9f13d6f..73ec93c22 100644 --- a/modules/shared_options.py +++ b/modules/shared_options.py @@ -102,6 +102,7 @@ options_templates.update(options_section(('upscaling', "Upscaling", "postprocess "DAT_tile_overlap": OptionInfo(8, "Tile overlap for DAT upscalers.", gr.Slider, {"minimum": 0, "maximum": 48, "step": 1}).info("Low values = visible seam"), "upscaler_for_img2img": OptionInfo(None, "Upscaler for img2img", gr.Dropdown, lambda: {"choices": [x.name for x in shared.sd_upscalers]}), "set_scale_by_when_changing_upscaler": OptionInfo(False, "Automatically set the Scale by factor based on the name of the selected Upscaler."), + "show_limit_target_resolution_in_extras_upscale": OptionInfo(False, 'Show "Limit target resolution" slider in "Upscale" extras script. Useful for batches where can be big images.'), })) options_templates.update(options_section(('face-restoration', "Face restoration", "postprocessing"), { diff --git a/scripts/postprocessing_upscale.py b/scripts/postprocessing_upscale.py index 6259017b5..485ff7848 100644 --- a/scripts/postprocessing_upscale.py +++ b/scripts/postprocessing_upscale.py @@ -44,8 +44,11 @@ class ScriptPostprocessingUpscale(scripts_postprocessing.ScriptPostprocessing): with gr.Tabs(elem_id="extras_resize_mode"): with gr.TabItem('Scale by', elem_id="extras_scale_by_tab") as tab_scale_by: upscaling_resize = gr.Slider(minimum=1.0, maximum=8.0, step=0.05, label="Resize", value=4, elem_id="extras_upscaling_resize") - limit_target_resolution = gr.Slider(minimum=0, maximum=10000, step=8, label="Limit target resolution", value=0, elem_id="extras_upscale_limit_target_resolution", - tooltip="0 = no limit. Limit target resolution by one demension. Useful for batches where can be big images.") + if shared.opts.show_limit_target_resolution_in_extras_upscale: + limit_target_resolution = gr.Slider(minimum=0, maximum=10000, step=8, label="Limit target resolution", value=8000, elem_id="extras_upscale_limit_target_resolution", + tooltip="0 = no limit. Limit target resolution by one demension. Useful for batches where can be big images.") + else: + limit_target_resolution = gr.Number(0, visible=False) with gr.TabItem('Scale to', elem_id="extras_scale_to_tab") as tab_scale_to: with FormRow():