mirror of
https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
synced 2025-08-03 10:50:23 +00:00
Merge branch 'dev' into move_upscale_postprocessing_under_input_accordion
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
import re
|
||||
|
||||
from PIL import Image
|
||||
import numpy as np
|
||||
|
||||
@@ -39,10 +41,22 @@ class ScriptPostprocessingUpscale(scripts_postprocessing.ScriptPostprocessing):
|
||||
upscaling_res_switch_btn = ToolButton(value=switch_values_symbol, elem_id="upscaling_res_switch_btn", tooltip="Switch width/height")
|
||||
upscaling_crop = gr.Checkbox(label='Crop to fit', value=True, elem_id="extras_upscaling_crop")
|
||||
|
||||
def on_selected_upscale_method(upscale_method):
|
||||
if not shared.opts.set_scale_by_when_changing_upscaler:
|
||||
return gr.update()
|
||||
|
||||
match = re.search(r'(\d)[xX]|[xX](\d)', upscale_method)
|
||||
if not match:
|
||||
return gr.update()
|
||||
|
||||
return gr.update(value=int(match.group(1) or match.group(2)))
|
||||
|
||||
upscaling_res_switch_btn.click(lambda w, h: (h, w), inputs=[upscaling_resize_w, upscaling_resize_h], outputs=[upscaling_resize_w, upscaling_resize_h], show_progress=False)
|
||||
tab_scale_by.select(fn=lambda: 0, inputs=[], outputs=[selected_tab])
|
||||
tab_scale_to.select(fn=lambda: 1, inputs=[], outputs=[selected_tab])
|
||||
|
||||
extras_upscaler_1.change(on_selected_upscale_method, inputs=[extras_upscaler_1], outputs=[upscaling_resize], show_progress="hidden")
|
||||
|
||||
return {
|
||||
"upscale_enabled": upscale_enabled,
|
||||
"upscale_mode": selected_tab,
|
||||
|
Reference in New Issue
Block a user