aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobert Barron <rubberbaron@robustspread.com>2023-07-30 07:41:10 +0000
committerRobert Barron <rubberbaron@robustspread.com>2023-07-30 10:45:02 +0000
commitc4ee6d9b73300d906b8df4602157d646df2415ef (patch)
treecd93ed68c70dd98eb4750ac25dd1181c8c0a9bb9
parent68f336bd994bed5442ad95bad6b6ad5564a5409a (diff)
downloadstable-diffusion-webui-gfx803-c4ee6d9b73300d906b8df4602157d646df2415ef.tar.gz
stable-diffusion-webui-gfx803-c4ee6d9b73300d906b8df4602157d646df2415ef.tar.bz2
stable-diffusion-webui-gfx803-c4ee6d9b73300d906b8df4602157d646df2415ef.zip
xyz_grid: allow varying the seed along an axis along with the axis's other changes
-rw-r--r--scripts/xyz_grid.py18
1 files changed, 16 insertions, 2 deletions
diff --git a/scripts/xyz_grid.py b/scripts/xyz_grid.py
index 1010845e..4eb1b197 100644
--- a/scripts/xyz_grid.py
+++ b/scripts/xyz_grid.py
@@ -417,6 +417,10 @@ class Script(scripts.Script):
include_lone_images = gr.Checkbox(label='Include Sub Images', value=False, elem_id=self.elem_id("include_lone_images"))
include_sub_grids = gr.Checkbox(label='Include Sub Grids', value=False, elem_id=self.elem_id("include_sub_grids"))
with gr.Column():
+ vary_seeds_x = gr.Checkbox(label='Vary seed on X axis', value=False, elem_id=self.elem_id("vary_seeds_x"))
+ vary_seeds_y = gr.Checkbox(label='Vary seed on Y axis', value=False, elem_id=self.elem_id("vary_seeds_y"))
+ vary_seeds_z = gr.Checkbox(label='Vary seed on Z axis', value=False, elem_id=self.elem_id("vary_seeds_z"))
+ with gr.Column():
margin_size = gr.Slider(label="Grid margins (px)", minimum=0, maximum=500, value=0, step=2, elem_id=self.elem_id("margin_size"))
with gr.Row(variant="compact", elem_id="swap_axes"):
@@ -475,9 +479,9 @@ class Script(scripts.Script):
(z_values_dropdown, lambda params:get_dropdown_update_from_params("Z",params)),
)
- return [x_type, x_values, x_values_dropdown, y_type, y_values, y_values_dropdown, z_type, z_values, z_values_dropdown, draw_legend, include_lone_images, include_sub_grids, no_fixed_seeds, margin_size]
+ return [x_type, x_values, x_values_dropdown, y_type, y_values, y_values_dropdown, z_type, z_values, z_values_dropdown, draw_legend, include_lone_images, include_sub_grids, no_fixed_seeds, vary_seeds_x, vary_seeds_y, vary_seeds_z, margin_size]
- def run(self, p, x_type, x_values, x_values_dropdown, y_type, y_values, y_values_dropdown, z_type, z_values, z_values_dropdown, draw_legend, include_lone_images, include_sub_grids, no_fixed_seeds, margin_size):
+ def run(self, p, x_type, x_values, x_values_dropdown, y_type, y_values, y_values_dropdown, z_type, z_values, z_values_dropdown, draw_legend, include_lone_images, include_sub_grids, no_fixed_seeds, vary_seeds_x, vary_seeds_y, vary_seeds_z, margin_size):
if not no_fixed_seeds:
modules.processing.fix_seed(p)
@@ -648,6 +652,16 @@ class Script(scripts.Script):
y_opt.apply(pc, y, ys)
z_opt.apply(pc, z, zs)
+ xdim = len(xs) if vary_seeds_x else 1
+ ydim = len(ys) if vary_seeds_y else 1
+
+ if vary_seeds_x:
+ pc.seed += ix
+ if vary_seeds_y:
+ pc.seed += iy * xdim
+ if vary_seeds_z:
+ pc.seed += iz * xdim * ydim
+
res = process_images(pc)
# Sets subgrid infotexts