Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
S
Stable Diffusion Webui
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
novelai-storage
Stable Diffusion Webui
Commits
8711c2fe
Commit
8711c2fe
authored
Oct 12, 2022
by
Greg Fuller
Committed by
AUTOMATIC1111
Oct 13, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix metadata contents
parent
aeacbac2
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
22 deletions
+35
-22
modules/ui.py
modules/ui.py
+1
-4
scripts/xy_grid.py
scripts/xy_grid.py
+34
-18
No files found.
modules/ui.py
View file @
8711c2fe
...
@@ -148,10 +148,7 @@ def save_files(js_data, images, do_make_zip, index):
...
@@ -148,10 +148,7 @@ def save_files(js_data, images, do_make_zip, index):
is_grid
=
image_index
<
p
.
index_of_first_image
is_grid
=
image_index
<
p
.
index_of_first_image
i
=
0
if
is_grid
else
(
image_index
-
p
.
index_of_first_image
)
i
=
0
if
is_grid
else
(
image_index
-
p
.
index_of_first_image
)
seed
=
p
.
all_seeds
[
i
]
if
len
(
p
.
all_seeds
)
>
1
else
p
.
seed
fullfn
,
txt_fullfn
=
save_image
(
image
,
path
,
""
,
seed
=
p
.
all_seeds
[
i
],
prompt
=
p
.
all_prompts
[
i
],
extension
=
extension
,
info
=
p
.
infotexts
[
image_index
],
grid
=
is_grid
,
p
=
p
,
save_to_dirs
=
save_to_dirs
)
prompt
=
p
.
all_prompts
[
i
]
if
len
(
p
.
all_prompts
)
>
1
else
p
.
prompt
info
=
p
.
infotexts
[
image_index
]
if
len
(
p
.
infotexts
)
>
1
else
p
.
infotexts
[
0
]
fullfn
,
txt_fullfn
=
save_image
(
image
,
path
,
""
,
seed
=
seed
,
prompt
=
prompt
,
extension
=
extension
,
info
=
info
,
grid
=
is_grid
,
p
=
p
,
save_to_dirs
=
save_to_dirs
)
filename
=
os
.
path
.
relpath
(
fullfn
,
path
)
filename
=
os
.
path
.
relpath
(
fullfn
,
path
)
filenames
.
append
(
filename
)
filenames
.
append
(
filename
)
...
...
scripts/xy_grid.py
View file @
8711c2fe
...
@@ -176,13 +176,16 @@ axis_options = [
...
@@ -176,13 +176,16 @@ axis_options = [
def
draw_xy_grid
(
p
,
xs
,
ys
,
x_labels
,
y_labels
,
cell
,
draw_legend
,
include_lone_images
):
def
draw_xy_grid
(
p
,
xs
,
ys
,
x_labels
,
y_labels
,
cell
,
draw_legend
,
include_lone_images
):
res
=
[]
successful_images
=
[]
ver_texts
=
[[
images
.
GridAnnotation
(
y
)]
for
y
in
y_labels
]
ver_texts
=
[[
images
.
GridAnnotation
(
y
)]
for
y
in
y_labels
]
hor_texts
=
[[
images
.
GridAnnotation
(
x
)]
for
x
in
x_labels
]
hor_texts
=
[[
images
.
GridAnnotation
(
x
)]
for
x
in
x_labels
]
first_processed
=
None
# Temporary list of all the images that are generated to be populated into the grid.
# Will be filled with empty images for any individual step that fails to process properly
image_cache
=
[]
processed_result
=
None
cell_mode
=
"P"
cell_size
=
(
1
,
1
)
state
.
job_count
=
len
(
xs
)
*
len
(
ys
)
*
p
.
n_iter
state
.
job_count
=
len
(
xs
)
*
len
(
ys
)
*
p
.
n_iter
...
@@ -190,26 +193,39 @@ def draw_xy_grid(p, xs, ys, x_labels, y_labels, cell, draw_legend, include_lone_
...
@@ -190,26 +193,39 @@ def draw_xy_grid(p, xs, ys, x_labels, y_labels, cell, draw_legend, include_lone_
for
ix
,
x
in
enumerate
(
xs
):
for
ix
,
x
in
enumerate
(
xs
):
state
.
job
=
f
"{ix + iy * len(xs) + 1} out of {len(xs) * len(ys)}"
state
.
job
=
f
"{ix + iy * len(xs) + 1} out of {len(xs) * len(ys)}"
processed
=
cell
(
x
,
y
)
processed
:
Processed
=
cell
(
x
,
y
)
if
first_processed
is
None
:
first_processed
=
processed
try
:
try
:
processed_image
=
processed
.
images
[
0
]
# this dereference will throw an exception if the image was not processed
res
.
append
(
processed_image
)
# (this happens in cases such as if the user stops the process from the UI)
successful_images
.
append
(
processed_image
)
processed_image
=
processed
.
images
[
0
]
if
processed_result
is
None
:
# Use our first valid processed result as a template container to hold our full results
processed_result
=
copy
(
processed
)
cell_mode
=
processed_image
.
mode
cell_size
=
processed_image
.
size
processed_result
.
images
=
[
Image
.
new
(
cell_mode
,
cell_size
)]
image_cache
.
append
(
processed_image
)
if
include_lone_images
:
processed_result
.
images
.
append
(
processed_image
)
processed_result
.
all_prompts
.
append
(
processed
.
prompt
)
processed_result
.
all_seeds
.
append
(
processed
.
seed
)
processed_result
.
infotexts
.
append
(
processed
.
infotexts
[
0
])
except
:
except
:
res
.
append
(
Image
.
new
(
res
[
0
]
.
mode
,
res
[
0
]
.
size
))
image_cache
.
append
(
Image
.
new
(
cell_mode
,
cell_size
))
if
not
processed_result
:
print
(
"Unexpected error: draw_xy_grid failed to return even a single processed image"
)
return
Processed
()
grid
=
images
.
image_grid
(
res
,
rows
=
len
(
ys
))
grid
=
images
.
image_grid
(
image_cache
,
rows
=
len
(
ys
))
if
draw_legend
:
if
draw_legend
:
grid
=
images
.
draw_grid_annotations
(
grid
,
res
[
0
]
.
width
,
res
[
0
]
.
height
,
hor_texts
,
ver_texts
)
grid
=
images
.
draw_grid_annotations
(
grid
,
cell_size
[
0
],
cell_size
[
1
]
,
hor_texts
,
ver_texts
)
first_processed
.
images
=
[
grid
]
processed_result
.
images
[
0
]
=
grid
if
include_lone_images
:
first_processed
.
images
+=
successful_images
return
first_processed
return
processed_result
re_range
=
re
.
compile
(
r"\s*([+-]?\s*\d+)\s*-\s*([+-]?\s*\d+)(?:\s*\(([+-]\d+)\s*\))?\s*"
)
re_range
=
re
.
compile
(
r"\s*([+-]?\s*\d+)\s*-\s*([+-]?\s*\d+)(?:\s*\(([+-]\d+)\s*\))?\s*"
)
...
...
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