Skip to content
GitLab
菜单
为什么选择 GitLab
定价
联系销售
探索
为什么选择 GitLab
定价
联系销售
探索
登录
获取免费试用
主导航
搜索或转到…
项目
S
Stable Diffusion Webui
管理
动态
成员
代码
仓库
分支
提交
标签
仓库图
比较修订版本
部署
模型注册表
分析
模型实验
帮助
帮助
支持
GitLab 文档
比较 GitLab 各版本
社区论坛
为极狐GitLab 提交贡献
提交反馈
隐私声明
快捷键
?
新增功能
4
代码片段
群组
项目
显示更多面包屑
Hunter0726
Stable Diffusion Webui
提交
e5520232
提交
e5520232
编辑于
2 years ago
作者:
Vladimir Repin
浏览文件
操作
下载
补丁
差异文件
make current_axis_options class variable
上级
ac2eb97d
No related branches found
No related tags found
无相关合并请求
变更
1
隐藏空白变更内容
行内
左右并排
显示
1 个更改的文件
scripts/xy_grid.py
+8
-9
8 个添加, 9 个删除
scripts/xy_grid.py
有
8 个添加
和
9 个删除
scripts/xy_grid.py
+
8
−
9
浏览文件 @
e5520232
...
...
@@ -293,17 +293,17 @@ class Script(scripts.Script):
return
"
X/Y plot
"
def
ui
(
self
,
is_img2img
):
current_axis_options
=
[
x
for
x
in
axis_options
if
type
(
x
)
==
AxisOption
or
x
.
is_img2img
==
is_img2img
]
self
.
current_axis_options
=
[
x
for
x
in
axis_options
if
type
(
x
)
==
AxisOption
or
x
.
is_img2img
==
is_img2img
]
with
gr
.
Row
():
with
gr
.
Column
(
scale
=
19
):
with
gr
.
Row
():
x_type
=
gr
.
Dropdown
(
label
=
"
X type
"
,
choices
=
[
x
.
label
for
x
in
current_axis_options
],
value
=
current_axis_options
[
1
].
label
,
type
=
"
index
"
,
elem_id
=
self
.
elem_id
(
"
x_type
"
))
x_type
=
gr
.
Dropdown
(
label
=
"
X type
"
,
choices
=
[
x
.
label
for
x
in
self
.
current_axis_options
],
value
=
self
.
current_axis_options
[
1
].
label
,
type
=
"
index
"
,
elem_id
=
self
.
elem_id
(
"
x_type
"
))
x_values
=
gr
.
Textbox
(
label
=
"
X values
"
,
lines
=
1
,
elem_id
=
self
.
elem_id
(
"
x_values
"
))
fill_x_button
=
ToolButton
(
value
=
fill_values_symbol
,
elem_id
=
"
xy_grid_fill_x_tool_button
"
,
visible
=
False
)
with
gr
.
Row
():
y_type
=
gr
.
Dropdown
(
label
=
"
Y type
"
,
choices
=
[
x
.
label
for
x
in
current_axis_options
],
value
=
current_axis_options
[
0
].
label
,
type
=
"
index
"
,
elem_id
=
self
.
elem_id
(
"
y_type
"
))
y_type
=
gr
.
Dropdown
(
label
=
"
Y type
"
,
choices
=
[
x
.
label
for
x
in
self
.
current_axis_options
],
value
=
self
.
current_axis_options
[
0
].
label
,
type
=
"
index
"
,
elem_id
=
self
.
elem_id
(
"
y_type
"
))
y_values
=
gr
.
Textbox
(
label
=
"
Y values
"
,
lines
=
1
,
elem_id
=
self
.
elem_id
(
"
y_values
"
))
fill_y_button
=
ToolButton
(
value
=
fill_values_symbol
,
elem_id
=
"
xy_grid_fill_y_tool_button
"
,
visible
=
False
)
...
...
@@ -314,21 +314,20 @@ class Script(scripts.Script):
swap_axes_button
=
gr
.
Button
(
value
=
"
Swap axes
"
,
elem_id
=
"
xy_grid_swap_axes_button
"
)
def
swap_axes
(
x_type
,
x_values
,
y_type
,
y_values
):
nonlocal
current_axis_options
return
current_axis_options
[
y_type
].
label
,
y_values
,
current_axis_options
[
x_type
].
label
,
x_values
return
self
.
current_axis_options
[
y_type
].
label
,
y_values
,
self
.
current_axis_options
[
x_type
].
label
,
x_values
swap_args
=
[
x_type
,
x_values
,
y_type
,
y_values
]
swap_axes_button
.
click
(
swap_axes
,
inputs
=
swap_args
,
outputs
=
swap_args
)
def
fill
(
x_type
):
axis
=
current_axis_options
[
x_type
]
axis
=
self
.
current_axis_options
[
x_type
]
return
"
,
"
.
join
(
axis
.
choices
())
if
axis
.
choices
else
gr
.
update
()
fill_x_button
.
click
(
fn
=
fill
,
inputs
=
[
x_type
],
outputs
=
[
x_values
])
fill_y_button
.
click
(
fn
=
fill
,
inputs
=
[
y_type
],
outputs
=
[
y_values
])
def
select_axis
(
x_type
):
return
gr
.
Button
.
update
(
visible
=
current_axis_options
[
x_type
].
choices
is
not
None
)
return
gr
.
Button
.
update
(
visible
=
self
.
current_axis_options
[
x_type
].
choices
is
not
None
)
x_type
.
change
(
fn
=
select_axis
,
inputs
=
[
x_type
],
outputs
=
[
fill_x_button
])
y_type
.
change
(
fn
=
select_axis
,
inputs
=
[
y_type
],
outputs
=
[
fill_y_button
])
...
...
@@ -403,10 +402,10 @@ class Script(scripts.Script):
return
valslist
x_opt
=
axis_options
[
x_type
]
x_opt
=
self
.
current_
axis_options
[
x_type
]
xs
=
process_axis
(
x_opt
,
x_values
)
y_opt
=
axis_options
[
y_type
]
y_opt
=
self
.
current_
axis_options
[
y_type
]
ys
=
process_axis
(
y_opt
,
y_values
)
def
fix_axis_seeds
(
axis_opt
,
axis_list
):
...
...
此差异已折叠。
点击以展开。
预览
0%
加载中
请重试
或
添加新附件
.
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
保存评论
取消
想要评论请
注册
或
登录