mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
Fix IndexError when generating grid; --grid option can now be passed on shell command line
This commit is contained in:
parent
0abfc3cac6
commit
38701a6d7b
@ -93,6 +93,8 @@ class PngWriter:
|
|||||||
i = 0
|
i = 0
|
||||||
for r in range(0, rows):
|
for r in range(0, rows):
|
||||||
for c in range(0, cols):
|
for c in range(0, cols):
|
||||||
|
if i>=len(image_list):
|
||||||
|
break
|
||||||
grid_img.paste(image_list[i], (c * width, r * height))
|
grid_img.paste(image_list[i], (c * width, r * height))
|
||||||
i = i + 1
|
i = i + 1
|
||||||
|
|
||||||
|
@ -163,7 +163,9 @@ def main_loop(t2i, outdir, parser, infile):
|
|||||||
opt.seed = None
|
opt.seed = None
|
||||||
|
|
||||||
normalized_prompt = PromptFormatter(t2i, opt).normalize_prompt()
|
normalized_prompt = PromptFormatter(t2i, opt).normalize_prompt()
|
||||||
individual_images = not opt.grid
|
do_grid = opt.grid or t2i.grid
|
||||||
|
individual_images = not do_grid
|
||||||
|
|
||||||
if opt.outdir:
|
if opt.outdir:
|
||||||
if not os.path.exists(opt.outdir):
|
if not os.path.exists(opt.outdir):
|
||||||
os.makedirs(opt.outdir)
|
os.makedirs(opt.outdir)
|
||||||
@ -180,8 +182,7 @@ def main_loop(t2i, outdir, parser, infile):
|
|||||||
file_writer.files_written if individual_images else image_list
|
file_writer.files_written if individual_images else image_list
|
||||||
)
|
)
|
||||||
|
|
||||||
grid = opt.grid or t2i.grid
|
if do_grid and len(results) > 0:
|
||||||
if grid and len(results) > 0:
|
|
||||||
grid_img = file_writer.make_grid([r[0] for r in results])
|
grid_img = file_writer.make_grid([r[0] for r in results])
|
||||||
filename = file_writer.unique_filename(results[0][1])
|
filename = file_writer.unique_filename(results[0][1])
|
||||||
seeds = [a[1] for a in results]
|
seeds = [a[1] for a in results]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user