This commit is contained in:
AUTOMATIC 2022-12-10 11:20:43 +03:00
parent 9763623610
commit 7dab7c9759

View file

@ -46,11 +46,11 @@ class Script(scripts.Script):
def ui(self, is_img2img): def ui(self, is_img2img):
put_at_start = gr.Checkbox(label='Put variable parts at start of prompt', value=False) put_at_start = gr.Checkbox(label='Put variable parts at start of prompt', value=False)
random_seeds = gr.Checkbox(label='Keep -1 for seeds', value=False) different_seeds = gr.Checkbox(label='Use different seed for each picture', value=False)
return [put_at_start, random_seeds] return [put_at_start, different_seeds]
def run(self, p, put_at_start, random_seeds): def run(self, p, put_at_start, different_seeds):
modules.processing.fix_seed(p) modules.processing.fix_seed(p)
original_prompt = p.prompt[0] if type(p.prompt) == list else p.prompt original_prompt = p.prompt[0] if type(p.prompt) == list else p.prompt
@ -74,13 +74,7 @@ class Script(scripts.Script):
print(f"Prompt matrix will create {len(all_prompts)} images using a total of {p.n_iter} batches.") print(f"Prompt matrix will create {len(all_prompts)} images using a total of {p.n_iter} batches.")
p.prompt = all_prompts p.prompt = all_prompts
if random_seeds: p.seed = [p.seed + (i if different_seeds else 0) for i in range(len(all_prompts))]
base = p.seed
p.seed = []
for i in range(len(all_prompts)):
p.seed.append(base+1)
else:
p.seed = [p.seed for _ in all_prompts]
p.prompt_for_display = original_prompt p.prompt_for_display = original_prompt
processed = process_images(p) processed = process_images(p)