Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Overbill1683
Stable Diffusion Webui
提交
ef6b8123
S
Stable Diffusion Webui
项目概览
Overbill1683
/
Stable Diffusion Webui
9 个月 前同步成功
通知
1733
Star
80
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
分析
仓库
DevOps
项目成员
Pages
S
Stable Diffusion Webui
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Pages
分析
分析
仓库分析
DevOps
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
提交
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
ef6b8123
编写于
12月 02, 2023
作者:
A
AUTOMATIC1111
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
put code that can cause an exception into its own function for #14120
上级
5ed7daa3
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
33 addition
and
29 deletion
+33
-29
modules/scripts.py
modules/scripts.py
+33
-29
未找到文件。
modules/scripts.py
浏览文件 @
ef6b8123
...
...
@@ -560,54 +560,58 @@ class ScriptRunner:
on_after
.
clear
()
def
create_script_ui
(
self
,
script
):
import
modules.api.models
as
api_models
script
.
args_from
=
len
(
self
.
inputs
)
script
.
args_to
=
len
(
self
.
inputs
)
try
:
self
.
create_script_ui_inner
(
script
)
except
Exception
:
errors
.
report
(
f
"Error creating UI for
{
script
.
name
}
: "
,
exc_info
=
True
)
def
create_script_ui_inner
(
self
,
script
):
import
modules.api.models
as
api_models
controls
=
wrap_call
(
script
.
ui
,
script
.
filename
,
"ui"
,
script
.
is_img2img
)
if
controls
is
None
:
return
try
:
script
.
name
=
wrap_call
(
script
.
title
,
script
.
filename
,
"title"
,
default
=
script
.
filename
).
lower
()
api_args
=
[]
script
.
name
=
wrap_call
(
script
.
title
,
script
.
filename
,
"title"
,
default
=
script
.
filename
).
lower
()
for
control
in
controls
:
control
.
custom_script_source
=
os
.
path
.
basename
(
script
.
filename
)
api_args
=
[]
arg_info
=
api_models
.
ScriptArg
(
label
=
control
.
label
or
""
)
for
control
in
controls
:
control
.
custom_script_source
=
os
.
path
.
basename
(
script
.
filename
)
for
field
in
(
"value"
,
"minimum"
,
"maximum"
,
"step"
):
v
=
getattr
(
control
,
field
,
None
)
if
v
is
not
None
:
setattr
(
arg_info
,
field
,
v
)
arg_info
=
api_models
.
ScriptArg
(
label
=
control
.
label
or
""
)
choices
=
getattr
(
control
,
'choices'
,
None
)
# as of gradio 3.41, some items in choices are strings, and some are tuples where the first elem is the string
if
choices
is
not
None
:
arg_info
.
choices
=
[
x
[
0
]
if
isinstance
(
x
,
tuple
)
else
x
for
x
in
choices
]
for
field
in
(
"value"
,
"minimum"
,
"maximum"
,
"step"
):
v
=
getattr
(
control
,
field
,
None
)
if
v
is
not
None
:
setattr
(
arg_info
,
field
,
v
)
api_args
.
append
(
arg_info
)
choices
=
getattr
(
control
,
'choices'
,
None
)
# as of gradio 3.41, some items in choices are strings, and some are tuples where the first elem is the string
if
choices
is
not
None
:
arg_info
.
choices
=
[
x
[
0
]
if
isinstance
(
x
,
tuple
)
else
x
for
x
in
choices
]
script
.
api_info
=
api_models
.
ScriptInfo
(
name
=
script
.
name
,
is_img2img
=
script
.
is_img2img
,
is_alwayson
=
script
.
alwayson
,
args
=
api_args
,
)
api_args
.
append
(
arg_info
)
if
script
.
infotext_fields
is
not
None
:
self
.
infotext_fields
+=
script
.
infotext_fields
script
.
api_info
=
api_models
.
ScriptInfo
(
name
=
script
.
name
,
is_img2img
=
script
.
is_img2img
,
is_alwayson
=
script
.
alwayson
,
args
=
api_args
,
)
if
script
.
paste_field_name
s
is
not
None
:
self
.
paste_field_names
+=
script
.
paste_field_name
s
if
script
.
infotext_field
s
is
not
None
:
self
.
infotext_fields
+=
script
.
infotext_field
s
self
.
inputs
+=
controls
s
cript
.
args_to
=
len
(
self
.
inputs
)
if
script
.
paste_field_names
is
not
None
:
s
elf
.
paste_field_names
+=
script
.
paste_field_names
except
Exception
:
errors
.
report
(
f
"Error creating UI for
{
script
.
name
}
: "
,
exc_info
=
True
)
self
.
inputs
+=
controls
script
.
args_to
=
len
(
self
.
inputs
)
def
setup_ui_for_section
(
self
,
section
,
scriptlist
=
None
):
if
scriptlist
is
None
:
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录