Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Overbill1683
Stable Diffusion Webui
提交
bb2faa5f
S
Stable Diffusion Webui
项目概览
Overbill1683
/
Stable Diffusion Webui
10 个月 前同步成功
通知
1746
Star
81
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
分析
仓库
DevOps
项目成员
Pages
S
Stable Diffusion Webui
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Pages
分析
分析
仓库分析
DevOps
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
提交
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
bb2faa5f
编写于
8月 30, 2022
作者:
A
AUTOMATIC
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
applied fill to all but one inpainting modes, fixed issue with mask resizing
上级
ff98e09d
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
16 addition
and
13 deletion
+16
-13
webui.py
webui.py
+16
-13
未找到文件。
webui.py
浏览文件 @
bb2faa5f
...
...
@@ -1145,27 +1145,16 @@ class StableDiffusionProcessingImg2Img(StableDiffusionProcessing):
self
.
sampler
=
samplers_for_img2img
[
self
.
sampler_index
].
constructor
()
if
self
.
original_mask
is
not
None
:
if
self
.
mask_blur
>
0
:
self
.
original_mask
=
self
.
original_mask
.
filter
(
ImageFilter
.
GaussianBlur
(
self
.
mask_blur
)).
convert
(
'L'
)
latmask
=
self
.
original_mask
.
convert
(
'RGB'
).
resize
((
64
,
64
))
latmask
=
np
.
moveaxis
(
np
.
array
(
latmask
,
dtype
=
np
.
float
),
2
,
0
)
/
255
latmask
=
latmask
[
0
]
latmask
=
np
.
tile
(
latmask
[
None
],
(
4
,
1
,
1
))
self
.
mask
=
torch
.
asarray
(
1.0
-
latmask
).
to
(
device
).
type
(
sd_model
.
dtype
)
self
.
nmask
=
torch
.
asarray
(
latmask
).
to
(
device
).
type
(
sd_model
.
dtype
)
self
.
original_mask
=
resize_image
(
self
.
resize_mode
,
self
.
original_mask
,
self
.
width
,
self
.
height
)
self
.
overlay_images
=
[]
imgs
=
[]
for
img
in
self
.
init_images
:
image
=
img
.
convert
(
"RGB"
)
image
=
resize_image
(
self
.
resize_mode
,
image
,
self
.
width
,
self
.
height
)
if
self
.
original_mask
is
not
None
:
if
self
.
inpainting_fill
==
0
:
if
self
.
inpainting_fill
!=
1
:
image
=
fill
(
image
,
self
.
original_mask
)
image_masked
=
Image
.
new
(
'RGBa'
,
(
image
.
width
,
image
.
height
))
...
...
@@ -1194,6 +1183,20 @@ class StableDiffusionProcessingImg2Img(StableDiffusionProcessing):
self
.
init_latent
=
sd_model
.
get_first_stage_encoding
(
sd_model
.
encode_first_stage
(
image
))
if
self
.
original_mask
is
not
None
:
if
self
.
mask_blur
>
0
:
self
.
original_mask
=
self
.
original_mask
.
filter
(
ImageFilter
.
GaussianBlur
(
self
.
mask_blur
)).
convert
(
'L'
)
latmask
=
self
.
original_mask
.
convert
(
'RGB'
).
resize
((
self
.
init_latent
.
shape
[
3
],
self
.
init_latent
.
shape
[
2
]))
latmask
=
np
.
moveaxis
(
np
.
array
(
latmask
,
dtype
=
np
.
float
),
2
,
0
)
/
255
latmask
=
latmask
[
0
]
latmask
=
np
.
tile
(
latmask
[
None
],
(
4
,
1
,
1
))
self
.
mask
=
torch
.
asarray
(
1.0
-
latmask
).
to
(
device
).
type
(
sd_model
.
dtype
)
self
.
nmask
=
torch
.
asarray
(
latmask
).
to
(
device
).
type
(
sd_model
.
dtype
)
def
sample
(
self
,
x
,
conditioning
,
unconditional_conditioning
):
t_enc
=
int
(
min
(
self
.
denoising_strength
,
0.999
)
*
self
.
steps
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录