Commit 4281f255 authored by wywywywy's avatar wywywywy Committed by GitHub

Implemented batch count logic to Outpainting mk2

parent 7f8ab1ee
...@@ -242,7 +242,14 @@ class Script(scripts.Script): ...@@ -242,7 +242,14 @@ class Script(scripts.Script):
out = out.crop((0, 0, res_w, res_h)) out = out.crop((0, 0, res_w, res_h))
return out return out
batch_count = p.n_iter
p.n_iter = 1
state.job_count = batch_count
all_images = []
for i in range(batch_count):
img = init_image img = init_image
state.job = f"Batch {i + 1} out of {state.job_count}"
if left > 0: if left > 0:
img = expand(img, left, is_left=True) img = expand(img, left, is_left=True)
...@@ -253,10 +260,19 @@ class Script(scripts.Script): ...@@ -253,10 +260,19 @@ class Script(scripts.Script):
if down > 0: if down > 0:
img = expand(img, down, is_bottom=True) img = expand(img, down, is_bottom=True)
res = Processed(p, [img], initial_seed_and_info[0], initial_seed_and_info[1]) all_images.append(img)
combined_grid_image = images.image_grid(all_images)
if opts.return_grid:
all_images = [combined_grid_image] + all_images
res = Processed(p, all_images, initial_seed_and_info[0], initial_seed_and_info[1])
if opts.samples_save: if opts.samples_save:
images.save_image(img, p.outpath_samples, "", res.seed, p.prompt, opts.grid_format, info=res.info, p=p) images.save_image(img, p.outpath_samples, "", res.seed, p.prompt, opts.grid_format, info=res.info, p=p)
if opts.grid_save:
images.save_image(combined_grid_image, p.outpath_grids, "grid", res.seed, p.prompt, opts.grid_format, info=res.info, short_filename=not opts.grid_extended_filename, grid=True, p=p)
return res return res
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment