Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
S
stable-diffusion-webui
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
stable-diffusion-webui
Commits
097a90b8
Commit
097a90b8
authored
Jan 04, 2023
by
AUTOMATIC
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add XY plot parameters to grid image and do not add them to individual images
parent
3f23e6da
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
15 deletions
+25
-15
processing.py
modules/processing.py
+1
-1
xy_grid.py
scripts/xy_grid.py
+24
-14
No files found.
modules/processing.py
View file @
097a90b8
...
...
@@ -422,7 +422,7 @@ def fix_seed(p):
p
.
subseed
=
get_fixed_seed
(
p
.
subseed
)
def
create_infotext
(
p
,
all_prompts
,
all_seeds
,
all_subseeds
,
comments
,
iteration
=
0
,
position_in_batch
=
0
):
def
create_infotext
(
p
,
all_prompts
,
all_seeds
,
all_subseeds
,
comments
=
None
,
iteration
=
0
,
position_in_batch
=
0
):
index
=
position_in_batch
+
iteration
*
p
.
batch_size
clip_skip
=
getattr
(
p
,
'clip_skip'
,
opts
.
CLIP_stop_at_last_layers
)
...
...
scripts/xy_grid.py
View file @
097a90b8
...
...
@@ -10,7 +10,7 @@ import numpy as np
import
modules.scripts
as
scripts
import
gradio
as
gr
from
modules
import
images
,
paths
,
sd_samplers
from
modules
import
images
,
paths
,
sd_samplers
,
processing
from
modules.hypernetworks
import
hypernetwork
from
modules.processing
import
process_images
,
Processed
,
StableDiffusionProcessingTxt2Img
from
modules.shared
import
opts
,
cmd_opts
,
state
...
...
@@ -285,6 +285,7 @@ re_range_float = re.compile(r"\s*([+-]?\s*\d+(?:.\d*)?)\s*-\s*([+-]?\s*\d+(?:.\d
re_range_count
=
re
.
compile
(
r"\s*([+-]?\s*\d+)\s*-\s*([+-]?\s*\d+)(?:\s*\[(\d+)\s*\])?\s*"
)
re_range_count_float
=
re
.
compile
(
r"\s*([+-]?\s*\d+(?:.\d*)?)\s*-\s*([+-]?\s*\d+(?:.\d*)?)(?:\s*\[(\d+(?:.\d*)?)\s*\])?\s*"
)
class
Script
(
scripts
.
Script
):
def
title
(
self
):
return
"X/Y plot"
...
...
@@ -381,7 +382,7 @@ class Script(scripts.Script):
ys
=
process_axis
(
y_opt
,
y_values
)
def
fix_axis_seeds
(
axis_opt
,
axis_list
):
if
axis_opt
.
label
in
[
'Seed'
,
'Var. seed'
]:
if
axis_opt
.
label
in
[
'Seed'
,
'Var. seed'
]:
return
[
int
(
random
.
randrange
(
4294967294
))
if
val
is
None
or
val
==
''
or
val
==
-
1
else
val
for
val
in
axis_list
]
else
:
return
axis_list
...
...
@@ -403,24 +404,33 @@ class Script(scripts.Script):
print
(
f
"X/Y plot will create {len(xs) * len(ys) * p.n_iter} images on a {len(xs)}x{len(ys)} grid. (Total steps to process: {total_steps * p.n_iter})"
)
shared
.
total_tqdm
.
updateTotal
(
total_steps
*
p
.
n_iter
)
grid_infotext
=
[
None
]
def
cell
(
x
,
y
):
pc
=
copy
(
p
)
x_opt
.
apply
(
pc
,
x
,
xs
)
y_opt
.
apply
(
pc
,
y
,
ys
)
return
process_images
(
pc
)
res
=
process_images
(
pc
)
if
grid_infotext
[
0
]
is
None
:
pc
.
extra_generation_params
=
copy
(
pc
.
extra_generation_params
)
if
x_opt
.
label
!=
'Nothing'
:
pc
.
extra_generation_params
[
"X Type"
]
=
x_opt
.
label
pc
.
extra_generation_params
[
"X Values"
]
=
x_values
if
x_opt
.
label
in
[
"Seed"
,
"Var. seed"
]
and
not
no_fixed_seeds
:
pc
.
extra_generation_params
[
"Fixed X Values"
]
=
", "
.
join
([
str
(
x
)
for
x
in
xs
])
if
y_opt
.
label
!=
'Nothing'
:
pc
.
extra_generation_params
[
"Y Type"
]
=
y_opt
.
label
pc
.
extra_generation_params
[
"Y Values"
]
=
y_values
if
y_opt
.
label
in
[
"Seed"
,
"Var. seed"
]
and
not
no_fixed_seeds
:
pc
.
extra_generation_params
[
"Fixed Y Values"
]
=
", "
.
join
([
str
(
y
)
for
y
in
ys
])
if
not
x_opt
.
label
==
'Nothing'
:
p
.
extra_generation_params
[
"XY Plot X Type"
]
=
x_opt
.
label
p
.
extra_generation_params
[
"XY Plot X Values"
]
=
'{'
+
x_values
+
'}'
if
x_opt
.
label
in
[
"Seed"
,
"Var. seed"
]
and
not
no_fixed_seeds
:
p
.
extra_generation_params
[
"XY Plot Fixed X Values"
]
=
'{'
+
", "
.
join
([
str
(
x
)
for
x
in
xs
])
+
'}'
grid_infotext
[
0
]
=
processing
.
create_infotext
(
pc
,
pc
.
all_prompts
,
pc
.
all_seeds
,
pc
.
all_subseeds
)
if
not
y_opt
.
label
==
'Nothing'
:
p
.
extra_generation_params
[
"XY Plot Y Type"
]
=
y_opt
.
label
p
.
extra_generation_params
[
"XY Plot Y Values"
]
=
'{'
+
y_values
+
'}'
if
y_opt
.
label
in
[
"Seed"
,
"Var. seed"
]
and
not
no_fixed_seeds
:
p
.
extra_generation_params
[
"XY Plot Fixed Y Values"
]
=
'{'
+
", "
.
join
([
str
(
y
)
for
y
in
ys
])
+
'}'
return
res
with
SharedSettingsStackHelper
():
processed
=
draw_xy_grid
(
...
...
@@ -435,6 +445,6 @@ class Script(scripts.Script):
)
if
opts
.
grid_save
:
images
.
save_image
(
processed
.
images
[
0
],
p
.
outpath_grids
,
"xy_grid"
,
extension
=
opts
.
grid_format
,
prompt
=
p
.
prompt
,
seed
=
processed
.
seed
,
grid
=
True
,
p
=
p
)
images
.
save_image
(
processed
.
images
[
0
],
p
.
outpath_grids
,
"xy_grid"
,
info
=
grid_infotext
[
0
],
extension
=
opts
.
grid_format
,
prompt
=
p
.
prompt
,
seed
=
processed
.
seed
,
grid
=
True
,
p
=
p
)
return
processed
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment