Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
sephuroth11
stable-diffusion-webui
提交
f3d83fd6
S
stable-diffusion-webui
项目概览
sephuroth11
/
stable-diffusion-webui
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
stable-diffusion-webui
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
f3d83fd6
编写于
9月 18, 2022
作者:
A
AUTOMATIC
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add read access to settings for jsavascript
add an option to disable lightbox modal
上级
21086e60
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
62 addition
and
5 deletion
+62
-5
javascript/imageviewer.js
javascript/imageviewer.js
+2
-2
javascript/ui.js
javascript/ui.js
+39
-0
modules/shared.py
modules/shared.py
+5
-0
modules/ui.py
modules/ui.py
+11
-2
script.js
script.js
+5
-1
未找到文件。
javascript/imageviewer.js
浏览文件 @
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
浏览文件 @
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
浏览文件 @
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
浏览文件 @
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'
)
s
ettings_s
ubmit
=
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
(
s
ettings_s
ubmit
.
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
浏览文件 @
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
);
}
})
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录