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
63a3ae2b
Commit
63a3ae2b
authored
Sep 01, 2022
by
AUTOMATIC
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix images not displayed when not saving
fix lack of left padding for grids with 1 row
parent
5a6c0740
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
26 deletions
+26
-26
webui.py
webui.py
+26
-26
No files found.
webui.py
View file @
63a3ae2b
...
...
@@ -548,7 +548,7 @@ def draw_grid_annotations(im, width, height, hor_texts, ver_texts):
color_active
=
(
0
,
0
,
0
)
color_inactive
=
(
153
,
153
,
153
)
pad_left
=
width
*
3
//
4
if
len
(
ver_texts
)
>
1
else
0
pad_left
=
width
*
3
//
4
if
len
(
ver_texts
)
>
0
else
0
cols
=
im
.
width
//
width
rows
=
im
.
height
//
height
...
...
@@ -1145,40 +1145,39 @@ def process_images(p: StableDiffusionProcessing) -> Processed:
x_samples_ddim
=
model
.
decode_first_stage
(
samples_ddim
)
x_samples_ddim
=
torch
.
clamp
((
x_samples_ddim
+
1.0
)
/
2.0
,
min
=
0.0
,
max
=
1.0
)
if
p
.
prompt_matrix
or
opts
.
samples_save
or
opts
.
grid_save
:
for
i
,
x_sample
in
enumerate
(
x_samples_ddim
):
x_sample
=
255.
*
np
.
moveaxis
(
x_sample
.
cpu
()
.
numpy
(),
0
,
2
)
x_sample
=
x_sample
.
astype
(
np
.
uint8
)
for
i
,
x_sample
in
enumerate
(
x_samples_ddim
):
x_sample
=
255.
*
np
.
moveaxis
(
x_sample
.
cpu
()
.
numpy
(),
0
,
2
)
x_sample
=
x_sample
.
astype
(
np
.
uint8
)
if
p
.
use_GFPGAN
:
torch_gc
()
if
p
.
use_GFPGAN
:
torch_gc
()
gfpgan_model
=
gfpgan
()
x_sample
=
gfpgan_fix_faces
(
gfpgan_model
,
x_sample
)
gfpgan_model
=
gfpgan
()
x_sample
=
gfpgan_fix_faces
(
gfpgan_model
,
x_sample
)
image
=
Image
.
fromarray
(
x_sample
)
image
=
Image
.
fromarray
(
x_sample
)
if
p
.
overlay_images
is
not
None
and
i
<
len
(
p
.
overlay_images
):
overlay
=
p
.
overlay_images
[
i
]
if
p
.
overlay_images
is
not
None
and
i
<
len
(
p
.
overlay_images
):
overlay
=
p
.
overlay_images
[
i
]
if
p
.
paste_to
is
not
None
:
x
,
y
,
w
,
h
=
p
.
paste_to
base_image
=
Image
.
new
(
'RGBA'
,
(
overlay
.
width
,
overlay
.
height
))
image
=
resize_image
(
1
,
image
,
w
,
h
)
base_image
.
paste
(
image
,
(
x
,
y
))
image
=
base_image
if
p
.
paste_to
is
not
None
:
x
,
y
,
w
,
h
=
p
.
paste_to
base_image
=
Image
.
new
(
'RGBA'
,
(
overlay
.
width
,
overlay
.
height
))
image
=
resize_image
(
1
,
image
,
w
,
h
)
base_image
.
paste
(
image
,
(
x
,
y
))
image
=
base_image
image
=
image
.
convert
(
'RGBA'
)
image
.
alpha_composite
(
overlay
)
image
=
image
.
convert
(
'RGB'
)
image
=
image
.
convert
(
'RGBA'
)
image
.
alpha_composite
(
overlay
)
image
=
image
.
convert
(
'RGB'
)
if
not
p
.
do_not_save_samples
:
save_image
(
image
,
p
.
outpath_samples
,
""
,
seeds
[
i
],
prompts
[
i
],
opts
.
samples_format
,
info
=
infotext
())
if
opts
.
samples_save
and
not
p
.
do_not_save_samples
:
save_image
(
image
,
p
.
outpath_samples
,
""
,
seeds
[
i
],
prompts
[
i
],
opts
.
samples_format
,
info
=
infotext
())
output_images
.
append
(
image
)
output_images
.
append
(
image
)
unwanted_grid_because_of_img_count
=
len
(
output_images
)
<
2
and
opts
.
grid_only_if_multiple
if
(
p
.
prompt_matrix
or
opts
.
grid_save
)
and
not
p
.
do_not_save_grid
and
not
unwanted_grid_because_of_img_count
:
if
not
p
.
do_not_save_grid
and
not
unwanted_grid_because_of_img_count
:
return_grid
=
opts
.
return_grid
if
p
.
prompt_matrix
:
...
...
@@ -1198,7 +1197,8 @@ def process_images(p: StableDiffusionProcessing) -> Processed:
if
return_grid
:
output_images
.
insert
(
0
,
grid
)
save_image
(
grid
,
p
.
outpath_grids
,
"grid"
,
seed
,
prompt
,
opts
.
grid_format
,
info
=
infotext
(),
short_filename
=
not
opts
.
grid_extended_filename
)
if
opts
.
grid_save
:
save_image
(
grid
,
p
.
outpath_grids
,
"grid"
,
seed
,
prompt
,
opts
.
grid_format
,
info
=
infotext
(),
short_filename
=
not
opts
.
grid_extended_filename
)
torch_gc
()
return
Processed
(
p
,
output_images
,
seed
,
infotext
())
...
...
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