Add enable option to redraw

This commit is contained in:
Антон Антонов
2023-01-02 20:20:19 +03:00
parent 627f3d4f5d
commit a29f8e32e0

View File

@@ -131,6 +131,7 @@ class Script(scripts.Script):
"<p style=\"margin-bottom:0.75em\">Will upscale the image to selected with and height</p>")
gr.HTML("<p style=\"margin-bottom:0.75em\">Redraw options:</p>")
with gr.Row():
redraw_enabled = gr.Checkbox(label="Enabled")
tileSize = gr.Slider(minimum=256, maximum=2048, step=64, label='Tile size', value=512)
mask_blur = gr.Slider(label='Mask blur', minimum=0, maximum=64, step=1, value=8)
padding = gr.Slider(label='Padding', minimum=0, maximum=128, step=1, value=32)
@@ -148,10 +149,10 @@ class Script(scripts.Script):
save_seam_path_image = gr.Checkbox(label="Seam path", value=True)
return [info, tileSize, mask_blur, padding, seam_pass_enabled, seam_pass_width, seam_pass_denoise,
seam_pass_padding, upscaler_index, save_upscaled_image, save_seam_path_image]
seam_pass_padding, upscaler_index, save_upscaled_image, save_seam_path_image, redraw_enabled]
def run(self, p, _, tileSize, mask_blur, padding, seam_pass_enabled, seam_pass_width, seam_pass_denoise,
seam_pass_padding, upscaler_index, save_upscaled_image, save_seam_path_image):
seam_pass_padding, upscaler_index, save_upscaled_image, save_seam_path_image, redraw_enabled):
processing.fix_seed(p)
p.extra_generation_params["SD upscale tileSize"] = tileSize
p.mask_blur = mask_blur
@@ -183,9 +184,9 @@ class Script(scripts.Script):
seams = rows - 1 + cols - 1
result_images = []
state.job_count = rows * cols + seams
result_image, initial_info = redraw_image(p, upscaled_img, rows, cols, tileSize, padding)
result_image = upscaled_img
if redraw_enabled:
result_image, initial_info = redraw_image(p, upscaled_img, rows, cols, tileSize, padding)
result_images.append(result_image)
if save_upscaled_image:
images.save_image(result_image, p.outpath_samples, "", seed, p.prompt, opts.grid_format, info=initial_info, p=p)