Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Overbill1683
Stable Diffusion Webui
提交
e46bfa5a
S
Stable Diffusion Webui
项目概览
Overbill1683
/
Stable Diffusion Webui
10 个月 前同步成功
通知
1736
Star
81
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
分析
仓库
DevOps
项目成员
Pages
S
Stable Diffusion Webui
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Pages
分析
分析
仓库分析
DevOps
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
提交
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
e46bfa5a
编写于
1月 24, 2023
作者:
E
EllangoK
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
handling sub grids and merging into one
上级
9fc354e1
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
19 addition
and
12 deletion
+19
-12
modules/images.py
modules/images.py
+1
-1
scripts/xyz_grid.py
scripts/xyz_grid.py
+18
-11
未找到文件。
modules/images.py
浏览文件 @
e46bfa5a
...
...
@@ -195,7 +195,7 @@ def draw_grid_annotations(im, width, height, hor_texts, ver_texts):
ver_text_heights
=
[
sum
([
line
.
size
[
1
]
+
line_spacing
for
line
in
lines
])
-
line_spacing
*
len
(
lines
)
for
lines
in
ver_texts
]
pad_top
=
max
(
hor_text_heights
)
+
line_spacing
*
2
pad_top
=
0
if
sum
(
hor_text_heights
)
==
0
else
max
(
hor_text_heights
)
+
line_spacing
*
2
result
=
Image
.
new
(
"RGB"
,
(
im
.
width
+
pad_left
,
im
.
height
+
pad_top
),
"white"
)
result
.
paste
(
im
,
(
pad_left
,
pad_top
))
...
...
scripts/xyz_grid.py
浏览文件 @
e46bfa5a
...
...
@@ -205,9 +205,9 @@ axis_options = [
]
def
draw_xyz_grid
(
p
,
xs
,
ys
,
zs
,
x_labels
,
y_labels
,
z_labels
,
cell
,
draw_legend
,
include_lone_images
,
swap_axes_processing_order
):
ver_texts
=
[[
images
.
GridAnnotation
(
y
)]
for
y
in
y_labels
]
def
draw_xyz_grid
(
p
,
xs
,
ys
,
zs
,
x_labels
,
y_labels
,
z_labels
,
cell
,
draw_legend
,
include_lone_images
,
include_sub_grids
,
swap_axes_processing_order
):
hor_texts
=
[[
images
.
GridAnnotation
(
x
)]
for
x
in
x_labels
]
ver_texts
=
[[
images
.
GridAnnotation
(
y
)]
for
y
in
y_labels
]
title_texts
=
[[
images
.
GridAnnotation
(
z
)]
for
z
in
z_labels
]
# Temporary list of all the images that are generated to be populated into the grid.
...
...
@@ -266,16 +266,21 @@ def draw_xyz_grid(p, xs, ys, zs, x_labels, y_labels, z_labels, cell, draw_legend
print
(
"Unexpected error: draw_xyz_grid failed to return even a single processed image"
)
return
Processed
(
p
,
[])
for
i
,
title_text
in
enumerate
(
title_texts
):
grids
=
[
None
]
*
len
(
zs
)
for
i
in
range
(
len
(
zs
)):
start_index
=
i
*
len
(
xs
)
*
len
(
ys
)
end_index
=
start_index
+
len
(
xs
)
*
len
(
ys
)
grid
=
images
.
image_grid
(
image_cache
[
start_index
:
end_index
],
rows
=
len
(
ys
))
if
draw_legend
:
grid
=
images
.
draw_grid_annotations
(
grid
,
cell_size
[
0
],
cell_size
[
1
],
hor_texts
,
ver_texts
)
if
i
==
0
:
# First position is a placeholder as mentioned above, so it can be directly replaced
processed_result
.
images
[
0
]
=
grid
else
:
processed_result
.
images
.
insert
(
i
,
grid
)
grids
[
i
]
=
grid
if
include_sub_grids
and
len
(
zs
)
>
1
:
processed_result
.
images
.
insert
(
i
+
1
,
grid
)
original_grid_size
=
grids
[
0
].
size
grids
=
images
.
image_grid
(
grids
,
rows
=
1
)
processed_result
.
images
[
0
]
=
images
.
draw_grid_annotations
(
grids
,
original_grid_size
[
0
],
original_grid_size
[
1
],
title_texts
,
[[
images
.
GridAnnotation
()]])
return
processed_result
...
...
@@ -326,7 +331,8 @@ class Script(scripts.Script):
with
gr
.
Row
(
variant
=
"compact"
,
elem_id
=
"axis_options"
):
draw_legend
=
gr
.
Checkbox
(
label
=
'Draw legend'
,
value
=
True
,
elem_id
=
self
.
elem_id
(
"draw_legend"
))
include_lone_images
=
gr
.
Checkbox
(
label
=
'Include Separate Images'
,
value
=
False
,
elem_id
=
self
.
elem_id
(
"include_lone_images"
))
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"
))
no_fixed_seeds
=
gr
.
Checkbox
(
label
=
'Keep -1 for seeds'
,
value
=
False
,
elem_id
=
self
.
elem_id
(
"no_fixed_seeds"
))
swap_xy_axes_button
=
gr
.
Button
(
value
=
"Swap X/Y axes"
,
elem_id
=
"xy_grid_swap_axes_button"
)
swap_yz_axes_button
=
gr
.
Button
(
value
=
"Swap Y/Z axes"
,
elem_id
=
"yz_grid_swap_axes_button"
)
...
...
@@ -357,9 +363,9 @@ class Script(scripts.Script):
y_type
.
change
(
fn
=
select_axis
,
inputs
=
[
y_type
],
outputs
=
[
fill_y_button
])
z_type
.
change
(
fn
=
select_axis
,
inputs
=
[
z_type
],
outputs
=
[
fill_z_button
])
return
[
x_type
,
x_values
,
y_type
,
y_values
,
z_type
,
z_values
,
draw_legend
,
include_lone_images
,
no_fixed_seeds
]
return
[
x_type
,
x_values
,
y_type
,
y_values
,
z_type
,
z_values
,
draw_legend
,
include_lone_images
,
include_sub_grids
,
no_fixed_seeds
]
def
run
(
self
,
p
,
x_type
,
x_values
,
y_type
,
y_values
,
z_type
,
z_values
,
draw_legend
,
include_lone_images
,
no_fixed_seeds
):
def
run
(
self
,
p
,
x_type
,
x_values
,
y_type
,
y_values
,
z_type
,
z_values
,
draw_legend
,
include_lone_images
,
include_sub_grids
,
no_fixed_seeds
):
if
not
no_fixed_seeds
:
modules
.
processing
.
fix_seed
(
p
)
...
...
@@ -527,10 +533,11 @@ class Script(scripts.Script):
zs
=
zs
,
x_labels
=
[
x_opt
.
format_value
(
p
,
x_opt
,
x
)
for
x
in
xs
],
y_labels
=
[
y_opt
.
format_value
(
p
,
y_opt
,
y
)
for
y
in
ys
],
z_labels
=
[
y
_opt
.
format_value
(
p
,
z_opt
,
z
)
for
z
in
zs
],
z_labels
=
[
z
_opt
.
format_value
(
p
,
z_opt
,
z
)
for
z
in
zs
],
cell
=
cell
,
draw_legend
=
draw_legend
,
include_lone_images
=
include_lone_images
,
include_sub_grids
=
include_sub_grids
,
swap_axes_processing_order
=
swap_axes_processing_order
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录