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
78278ce6
Commit
78278ce6
authored
Sep 04, 2022
by
AUTOMATIC
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added UI config file: ui-config.json
parent
836b6463
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
49 additions
and
2 deletions
+49
-2
README.md
README.md
+1
-0
modules/ui.py
modules/ui.py
+48
-2
No files found.
README.md
View file @
78278ce6
...
...
@@ -31,6 +31,7 @@ Original script with Gradio UI was written by a kind anonymous user. This is a m
-
Settings page
-
Running custom code from UI
-
Mouseover hints fo most UI elements
-
Possible to change defaults/mix/max/step values for UI elements via text config
## Installing and running
...
...
modules/ui.py
View file @
78278ce6
...
...
@@ -133,8 +133,15 @@ def wrap_gradio_call(func):
return
f
def
create_ui
(
txt2img
,
img2img
,
run_extras
,
run_pnginfo
):
def
visit
(
x
,
func
,
path
=
""
):
if
hasattr
(
x
,
'children'
):
for
c
in
x
.
children
:
visit
(
c
,
func
,
path
)
elif
x
.
label
is
not
None
:
func
(
path
+
"/"
+
str
(
x
.
label
),
x
)
def
create_ui
(
txt2img
,
img2img
,
run_extras
,
run_pnginfo
):
with
gr
.
Blocks
(
analytics_enabled
=
False
)
as
txt2img_interface
:
with
gr
.
Row
():
prompt
=
gr
.
Textbox
(
label
=
"Prompt"
,
elem_id
=
"txt2img_prompt"
,
show_label
=
False
,
placeholder
=
"Prompt"
,
lines
=
1
)
...
...
@@ -271,7 +278,6 @@ def create_ui(txt2img, img2img, run_extras, run_pnginfo):
with
gr
.
Group
():
custom_inputs
=
modules
.
scripts
.
scripts_img2img
.
setup_ui
(
is_img2img
=
True
)
with
gr
.
Column
(
variant
=
'panel'
):
with
gr
.
Group
():
img2img_gallery
=
gr
.
Gallery
(
label
=
'Output'
,
elem_id
=
'img2img_gallery'
)
...
...
@@ -517,6 +523,46 @@ def create_ui(txt2img, img2img, run_extras, run_pnginfo):
css
=
css
,
)
ui_config_file
=
os
.
path
.
join
(
modules
.
paths
.
script_path
,
'ui-config.json'
)
ui_settings
=
{}
settings_count
=
len
(
ui_settings
)
error_loading
=
False
try
:
if
os
.
path
.
exists
(
ui_config_file
):
with
open
(
ui_config_file
,
"r"
,
encoding
=
"utf8"
)
as
file
:
ui_settings
=
json
.
load
(
file
)
except
Exception
:
error_loading
=
True
print
(
"Error loading settings:"
,
file
=
sys
.
stderr
)
print
(
traceback
.
format_exc
(),
file
=
sys
.
stderr
)
def
loadsave
(
path
,
x
):
def
apply_field
(
obj
,
field
):
key
=
path
+
"/"
+
field
saved_value
=
ui_settings
.
get
(
key
,
None
)
if
saved_value
is
None
:
ui_settings
[
key
]
=
getattr
(
obj
,
field
)
else
:
setattr
(
obj
,
field
,
saved_value
)
if
type
(
x
)
==
gr
.
Slider
:
apply_field
(
x
,
'value'
)
apply_field
(
x
,
'minimum'
)
apply_field
(
x
,
'maximum'
)
apply_field
(
x
,
'step'
)
if
type
(
x
)
==
gr
.
Radio
:
apply_field
(
x
,
'value'
)
visit
(
txt2img_interface
,
loadsave
,
"txt2img"
)
visit
(
img2img_interface
,
loadsave
,
"img2img"
)
if
not
error_loading
and
(
not
os
.
path
.
exists
(
ui_config_file
)
or
settings_count
!=
len
(
ui_settings
)):
with
open
(
ui_config_file
,
"w"
,
encoding
=
"utf8"
)
as
file
:
json
.
dump
(
ui_settings
,
file
,
indent
=
4
)
return
demo
...
...
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