Merge pull request #5179 from kaneda2004/master

Update SD Upscaler to include user selectable Scale Factor
This commit is contained in:
AUTOMATIC1111 2022-12-10 13:28:45 +03:00 committed by GitHub
commit 854bb0b56c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -17,13 +17,14 @@ class Script(scripts.Script):
return is_img2img
def ui(self, is_img2img):
info = gr.HTML("<p style=\"margin-bottom:0.75em\">Will upscale the image to twice the dimensions; use width and height sliders to set tile size</p>")
info = gr.HTML("<p style=\"margin-bottom:0.75em\">Will upscale the image by the selected scale factor; use width and height sliders to set tile size</p>")
overlap = gr.Slider(minimum=0, maximum=256, step=16, label='Tile overlap', value=64)
scale_factor = gr.Slider(minimum=1, maximum=4, step=1, label='Scale Factor', value=2)
upscaler_index = gr.Radio(label='Upscaler', choices=[x.name for x in shared.sd_upscalers], value=shared.sd_upscalers[0].name, type="index")
return [info, overlap, upscaler_index]
return [info, overlap, upscaler_index, scale_factor]
def run(self, p, _, overlap, upscaler_index):
def run(self, p, _, overlap, upscaler_index, scale_factor):
processing.fix_seed(p)
upscaler = shared.sd_upscalers[upscaler_index]
@ -36,7 +37,7 @@ class Script(scripts.Script):
init_img = p.init_images[0]
if (upscaler.name != "None"):
img = upscaler.scaler.upscale(init_img, 2, upscaler.data_path)
img = upscaler.scaler.upscale(init_img, scale_factor, upscaler.data_path)
else:
img = init_img