Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Overbill1683
Stable Diffusion Webui
提交
2d5a5076
S
Stable Diffusion Webui
项目概览
Overbill1683
/
Stable Diffusion Webui
11 个月 前同步成功
通知
1771
Star
81
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
分析
仓库
DevOps
项目成员
Pages
S
Stable Diffusion Webui
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Pages
分析
分析
仓库分析
DevOps
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
提交
体验新版 GitCode,发现更多精彩内容 >>
提交
2d5a5076
编写于
1月 03, 2023
作者:
A
AUTOMATIC
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Make it so that upscalers are not repeated when restarting UI.
上级
e9fb9bb0
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
27 addition
and
7 deletion
+27
-7
modules/modelloader.py
modules/modelloader.py
+20
-0
webui.py
webui.py
+7
-7
未找到文件。
modules/modelloader.py
浏览文件 @
2d5a5076
...
@@ -123,6 +123,23 @@ def move_files(src_path: str, dest_path: str, ext_filter: str = None):
...
@@ -123,6 +123,23 @@ def move_files(src_path: str, dest_path: str, ext_filter: str = None):
pass
pass
builtin_upscaler_classes
=
[]
forbidden_upscaler_classes
=
set
()
def
list_builtin_upscalers
():
load_upscalers
()
builtin_upscaler_classes
.
clear
()
builtin_upscaler_classes
.
extend
(
Upscaler
.
__subclasses__
())
def
forbid_loaded_nonbuiltin_upscalers
():
for
cls
in
Upscaler
.
__subclasses__
():
if
cls
not
in
builtin_upscaler_classes
:
forbidden_upscaler_classes
.
add
(
cls
)
def
load_upscalers
():
def
load_upscalers
():
# We can only do this 'magic' method to dynamically load upscalers if they are referenced,
# We can only do this 'magic' method to dynamically load upscalers if they are referenced,
# so we'll try to import any _model.py files before looking in __subclasses__
# so we'll try to import any _model.py files before looking in __subclasses__
...
@@ -139,6 +156,9 @@ def load_upscalers():
...
@@ -139,6 +156,9 @@ def load_upscalers():
datas
=
[]
datas
=
[]
commandline_options
=
vars
(
shared
.
cmd_opts
)
commandline_options
=
vars
(
shared
.
cmd_opts
)
for
cls
in
Upscaler
.
__subclasses__
():
for
cls
in
Upscaler
.
__subclasses__
():
if
cls
in
forbidden_upscaler_classes
:
continue
name
=
cls
.
__name__
name
=
cls
.
__name__
cmd_name
=
f
"
{
name
.
lower
().
replace
(
'upscaler'
,
''
)
}
_models_path"
cmd_name
=
f
"
{
name
.
lower
().
replace
(
'upscaler'
,
''
)
}
_models_path"
scaler
=
cls
(
commandline_options
.
get
(
cmd_name
,
None
))
scaler
=
cls
(
commandline_options
.
get
(
cmd_name
,
None
))
...
...
webui.py
浏览文件 @
2d5a5076
import
os
import
os
import
sys
import
threading
import
threading
import
time
import
time
import
importlib
import
importlib
...
@@ -55,8 +56,8 @@ def initialize():
...
@@ -55,8 +56,8 @@ def initialize():
gfpgan
.
setup_model
(
cmd_opts
.
gfpgan_models_path
)
gfpgan
.
setup_model
(
cmd_opts
.
gfpgan_models_path
)
shared
.
face_restorers
.
append
(
modules
.
face_restoration
.
FaceRestoration
())
shared
.
face_restorers
.
append
(
modules
.
face_restoration
.
FaceRestoration
())
modelloader
.
list_builtin_upscalers
()
modules
.
scripts
.
load_scripts
()
modules
.
scripts
.
load_scripts
()
modelloader
.
load_upscalers
()
modelloader
.
load_upscalers
()
modules
.
sd_vae
.
refresh_vae_list
()
modules
.
sd_vae
.
refresh_vae_list
()
...
@@ -169,23 +170,22 @@ def webui():
...
@@ -169,23 +170,22 @@ def webui():
modules
.
script_callbacks
.
app_started_callback
(
shared
.
demo
,
app
)
modules
.
script_callbacks
.
app_started_callback
(
shared
.
demo
,
app
)
wait_on_server
(
shared
.
demo
)
wait_on_server
(
shared
.
demo
)
print
(
'Restarting UI...'
)
sd_samplers
.
set_samplers
()
sd_samplers
.
set_samplers
()
print
(
'Reloading extensions'
)
extensions
.
list_extensions
()
extensions
.
list_extensions
()
localization
.
list_localizations
(
cmd_opts
.
localizations_dir
)
localization
.
list_localizations
(
cmd_opts
.
localizations_dir
)
print
(
'Reloading custom scripts'
)
modelloader
.
forbid_loaded_nonbuiltin_upscalers
(
)
modules
.
scripts
.
reload_scripts
()
modules
.
scripts
.
reload_scripts
()
modelloader
.
load_upscalers
()
modelloader
.
load_upscalers
()
print
(
'Reloading modules: modules.ui'
)
for
module
in
[
module
for
name
,
module
in
sys
.
modules
.
items
()
if
name
.
startswith
(
"modules.ui"
)]:
importlib
.
reload
(
modules
.
ui
)
importlib
.
reload
(
module
)
print
(
'Refreshing Model List'
)
modules
.
sd_models
.
list_models
()
modules
.
sd_models
.
list_models
()
print
(
'Restarting Gradio'
)
if
__name__
==
"__main__"
:
if
__name__
==
"__main__"
:
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录