Skip to content
GitLab
菜单
为什么选择 GitLab
定价
联系销售
探索
为什么选择 GitLab
定价
联系销售
探索
登录
获取免费试用
主导航
搜索或转到…
项目
S
Stable Diffusion Webui
管理
动态
成员
代码
仓库
分支
提交
标签
仓库图
比较修订版本
部署
模型注册表
分析
模型实验
帮助
帮助
支持
GitLab 文档
比较 GitLab 各版本
社区论坛
为极狐GitLab 提交贡献
提交反馈
隐私声明
快捷键
?
新增功能
4
代码片段
群组
项目
显示更多面包屑
Hunter0726
Stable Diffusion Webui
提交
f3d83fd6
提交
f3d83fd6
编辑于
2 years ago
作者:
AUTOMATIC
浏览文件
操作
下载
补丁
差异文件
add read access to settings for jsavascript
add an option to disable lightbox modal
上级
21086e60
No related branches found
分支 包含提交
No related tags found
标签 包含提交
无相关合并请求
变更
5
隐藏空白变更内容
行内
左右并排
显示
5 个更改的文件
javascript/imageviewer.js
+2
-2
2 个添加, 2 个删除
javascript/imageviewer.js
javascript/ui.js
+39
-0
39 个添加, 0 个删除
javascript/ui.js
modules/shared.py
+5
-0
5 个添加, 0 个删除
modules/shared.py
modules/ui.py
+11
-2
11 个添加, 2 个删除
modules/ui.py
script.js
+5
-1
5 个添加, 1 个删除
script.js
有
62 个添加
和
5 个删除
javascript/imageviewer.js
+
2
−
2
浏览文件 @
f3d83fd6
...
...
@@ -70,8 +70,8 @@ function showGalleryImage(){
e
.
style
.
cursor
=
'
pointer
'
e
.
addEventListener
(
'
click
'
,
function
(
evt
)
{
showModal
(
evt
)
if
(
!
opts
.
js_modal_lightbox
)
return
;
showModal
(
evt
)
},
true
);
}
});
...
...
此差异已折叠。
点击以展开。
javascript/ui.js
+
39
−
0
浏览文件 @
f3d83fd6
...
...
@@ -59,3 +59,42 @@ function ask_for_style_name(_, prompt_text, negative_prompt_text) {
name_
=
prompt
(
'
Style name:
'
)
return
name_
===
null
?
[
null
,
null
,
null
]:
[
name_
,
prompt_text
,
negative_prompt_text
]
}
opts
=
{}
function
apply_settings
(
jsdata
){
console
.
log
(
jsdata
)
opts
=
JSON
.
parse
(
jsdata
)
return
jsdata
}
onUiUpdate
(
function
(){
if
(
Object
.
keys
(
opts
).
length
!=
0
)
return
;
json_elem
=
gradioApp
().
getElementById
(
'
settings_json
'
)
if
(
json_elem
==
null
)
return
;
textarea
=
json_elem
.
querySelector
(
'
textarea
'
)
jsdata
=
textarea
.
value
opts
=
JSON
.
parse
(
jsdata
)
Object
.
defineProperty
(
textarea
,
'
value
'
,
{
set
:
function
(
newValue
)
{
var
valueProp
=
Object
.
getOwnPropertyDescriptor
(
HTMLTextAreaElement
.
prototype
,
'
value
'
);
var
oldValue
=
valueProp
.
get
.
call
(
textarea
);
valueProp
.
set
.
call
(
textarea
,
newValue
);
if
(
oldValue
!=
newValue
)
{
opts
=
JSON
.
parse
(
textarea
.
value
)
}
},
get
:
function
()
{
var
valueProp
=
Object
.
getOwnPropertyDescriptor
(
HTMLTextAreaElement
.
prototype
,
'
value
'
);
return
valueProp
.
get
.
call
(
textarea
);
}
});
json_elem
.
parentElement
.
style
.
display
=
"
none
"
})
此差异已折叠。
点击以展开。
modules/shared.py
+
5
−
0
浏览文件 @
f3d83fd6
...
...
@@ -159,6 +159,7 @@ class Options:
"
interrogate_clip_max_length
"
:
OptionInfo
(
48
,
"
Interrogate: maximum description length
"
,
gr
.
Slider
,
{
"
minimum
"
:
1
,
"
maximum
"
:
256
,
"
step
"
:
1
}),
"
interrogate_clip_dict_limit
"
:
OptionInfo
(
1500
,
"
Interrogate: maximum number of lines in text file (0 = No limit)
"
),
"
sd_model_checkpoint
"
:
OptionInfo
(
None
,
"
Stable Diffusion checkpoint
"
,
gr
.
Radio
,
lambda
:
{
"
choices
"
:
[
x
.
title
for
x
in
modules
.
sd_models
.
checkpoints_list
.
values
()]}),
"
js_modal_lightbox
"
:
OptionInfo
(
True
,
"
Enable full page image viewer
"
),
}
def
__init__
(
self
):
...
...
@@ -193,6 +194,10 @@ class Options:
item
=
self
.
data_labels
.
get
(
key
)
item
.
onchange
=
func
def
dumpjson
(
self
):
d
=
{
k
:
self
.
data
.
get
(
k
,
self
.
data_labels
.
get
(
k
).
default
)
for
k
in
self
.
data_labels
.
keys
()}
return
json
.
dumps
(
d
)
opts
=
Options
()
if
os
.
path
.
exists
(
config_filename
):
...
...
此差异已折叠。
点击以展开。
modules/ui.py
+
11
−
2
浏览文件 @
f3d83fd6
...
...
@@ -858,7 +858,7 @@ def create_ui(txt2img, img2img, run_extras, run_pnginfo):
return
'
Settings applied.
'
with
gr
.
Blocks
(
analytics_enabled
=
False
)
as
settings_interface
:
submit
=
gr
.
Button
(
value
=
"
Apply settings
"
,
variant
=
'
primary
'
)
settings_
submit
=
gr
.
Button
(
value
=
"
Apply settings
"
,
variant
=
'
primary
'
)
result
=
gr
.
HTML
()
with
gr
.
Row
(
elem_id
=
"
settings
"
).
style
(
equal_height
=
False
):
...
...
@@ -870,7 +870,7 @@ def create_ui(txt2img, img2img, run_extras, run_pnginfo):
if
index
<
len
(
keys
):
components
.
append
(
create_setting_component
(
keys
[
index
]))
submit
.
click
(
settings_
submit
.
click
(
fn
=
run_settings
,
inputs
=
components
,
outputs
=
[
result
]
...
...
@@ -896,11 +896,20 @@ def create_ui(txt2img, img2img, run_extras, run_pnginfo):
css
+=
css_hide_progressbar
with
gr
.
Blocks
(
css
=
css
,
analytics_enabled
=
False
,
title
=
"
Stable Diffusion
"
)
as
demo
:
with
gr
.
Tabs
()
as
tabs
:
for
interface
,
label
,
ifid
in
interfaces
:
with
gr
.
TabItem
(
label
,
id
=
ifid
):
interface
.
render
()
text_settings
=
gr
.
Textbox
(
elem_id
=
"
settings_json
"
,
value
=
opts
.
dumpjson
(),
visible
=
False
)
settings_submit
.
click
(
fn
=
lambda
:
opts
.
dumpjson
(),
inputs
=
[],
outputs
=
[
text_settings
],
)
tabs
.
change
(
fn
=
lambda
x
:
x
,
inputs
=
[
init_img_with_mask
],
...
...
此差异已折叠。
点击以展开。
script.js
+
5
−
1
浏览文件 @
f3d83fd6
...
...
@@ -9,7 +9,11 @@ function onUiUpdate(callback){
function
uiUpdate
(
root
){
uiUpdateCallbacks
.
forEach
(
function
(
x
){
x
()
try
{
x
()
}
catch
(
e
)
{
(
console
.
error
||
console
.
log
).
call
(
console
,
e
.
message
,
e
);
}
})
}
...
...
此差异已折叠。
点击以展开。
预览
0%
加载中
请重试
或
添加新附件
.
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
保存评论
取消
想要评论请
注册
或
登录