Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
S
Stable Diffusion Webui
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
novelai-storage
Stable Diffusion Webui
Commits
f3d83fd6
Commit
f3d83fd6
authored
Sep 18, 2022
by
AUTOMATIC
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add read access to settings for jsavascript
add an option to disable lightbox modal
parent
21086e60
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
62 additions
and
5 deletions
+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
No files found.
javascript/imageviewer.js
View file @
f3d83fd6
...
@@ -70,8 +70,8 @@ function showGalleryImage(){
...
@@ -70,8 +70,8 @@ function showGalleryImage(){
e
.
style
.
cursor
=
'
pointer
'
e
.
style
.
cursor
=
'
pointer
'
e
.
addEventListener
(
'
click
'
,
function
(
evt
)
{
e
.
addEventListener
(
'
click
'
,
function
(
evt
)
{
if
(
!
opts
.
js_modal_lightbox
)
return
;
showModal
(
evt
)
showModal
(
evt
)
},
true
);
},
true
);
}
}
});
});
...
...
javascript/ui.js
View file @
f3d83fd6
...
@@ -59,3 +59,42 @@ function ask_for_style_name(_, prompt_text, negative_prompt_text) {
...
@@ -59,3 +59,42 @@ function ask_for_style_name(_, prompt_text, negative_prompt_text) {
name_
=
prompt
(
'
Style name:
'
)
name_
=
prompt
(
'
Style name:
'
)
return
name_
===
null
?
[
null
,
null
,
null
]:
[
name_
,
prompt_text
,
negative_prompt_text
]
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
View file @
f3d83fd6
...
@@ -159,6 +159,7 @@ class Options:
...
@@ -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_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)"
),
"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
()]}),
"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
):
def
__init__
(
self
):
...
@@ -193,6 +194,10 @@ class Options:
...
@@ -193,6 +194,10 @@ class Options:
item
=
self
.
data_labels
.
get
(
key
)
item
=
self
.
data_labels
.
get
(
key
)
item
.
onchange
=
func
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
()
opts
=
Options
()
if
os
.
path
.
exists
(
config_filename
):
if
os
.
path
.
exists
(
config_filename
):
...
...
modules/ui.py
View file @
f3d83fd6
...
@@ -858,7 +858,7 @@ def create_ui(txt2img, img2img, run_extras, run_pnginfo):
...
@@ -858,7 +858,7 @@ def create_ui(txt2img, img2img, run_extras, run_pnginfo):
return
'Settings applied.'
return
'Settings applied.'
with
gr
.
Blocks
(
analytics_enabled
=
False
)
as
settings_interface
:
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
()
result
=
gr
.
HTML
()
with
gr
.
Row
(
elem_id
=
"settings"
)
.
style
(
equal_height
=
False
):
with
gr
.
Row
(
elem_id
=
"settings"
)
.
style
(
equal_height
=
False
):
...
@@ -870,7 +870,7 @@ def create_ui(txt2img, img2img, run_extras, run_pnginfo):
...
@@ -870,7 +870,7 @@ def create_ui(txt2img, img2img, run_extras, run_pnginfo):
if
index
<
len
(
keys
):
if
index
<
len
(
keys
):
components
.
append
(
create_setting_component
(
keys
[
index
]))
components
.
append
(
create_setting_component
(
keys
[
index
]))
submit
.
click
(
s
ettings_s
ubmit
.
click
(
fn
=
run_settings
,
fn
=
run_settings
,
inputs
=
components
,
inputs
=
components
,
outputs
=
[
result
]
outputs
=
[
result
]
...
@@ -896,11 +896,20 @@ def create_ui(txt2img, img2img, run_extras, run_pnginfo):
...
@@ -896,11 +896,20 @@ def create_ui(txt2img, img2img, run_extras, run_pnginfo):
css
+=
css_hide_progressbar
css
+=
css_hide_progressbar
with
gr
.
Blocks
(
css
=
css
,
analytics_enabled
=
False
,
title
=
"Stable Diffusion"
)
as
demo
:
with
gr
.
Blocks
(
css
=
css
,
analytics_enabled
=
False
,
title
=
"Stable Diffusion"
)
as
demo
:
with
gr
.
Tabs
()
as
tabs
:
with
gr
.
Tabs
()
as
tabs
:
for
interface
,
label
,
ifid
in
interfaces
:
for
interface
,
label
,
ifid
in
interfaces
:
with
gr
.
TabItem
(
label
,
id
=
ifid
):
with
gr
.
TabItem
(
label
,
id
=
ifid
):
interface
.
render
()
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
(
tabs
.
change
(
fn
=
lambda
x
:
x
,
fn
=
lambda
x
:
x
,
inputs
=
[
init_img_with_mask
],
inputs
=
[
init_img_with_mask
],
...
...
script.js
View file @
f3d83fd6
...
@@ -9,7 +9,11 @@ function onUiUpdate(callback){
...
@@ -9,7 +9,11 @@ function onUiUpdate(callback){
function
uiUpdate
(
root
){
function
uiUpdate
(
root
){
uiUpdateCallbacks
.
forEach
(
function
(
x
){
uiUpdateCallbacks
.
forEach
(
function
(
x
){
try
{
x
()
x
()
}
catch
(
e
)
{
(
console
.
error
||
console
.
log
).
call
(
console
,
e
.
message
,
e
);
}
})
})
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment