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
e018c8a3
Commit
e018c8a3
authored
Apr 29, 2023
by
AUTOMATIC1111
Committed by
GitHub
Apr 29, 2023
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #8945 from space-nuko/gradio-theme-support
Support Gradio's theme API
parents
2c935d8e
e6cbfcfe
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
37 additions
and
1 deletion
+37
-1
modules/shared.py
modules/shared.py
+35
-0
modules/ui.py
modules/ui.py
+1
-1
webui.py
webui.py
+1
-0
No files found.
modules/shared.py
View file @
e018c8a3
...
...
@@ -4,6 +4,7 @@ import json
import
os
import
sys
import
time
import
requests
from
PIL
import
Image
import
gradio
as
gr
...
...
@@ -55,6 +56,21 @@ ui_reorder_categories = [
"scripts"
,
]
# https://huggingface.co/datasets/freddyaboulton/gradio-theme-subdomains/resolve/main/subdomains.json
gradio_hf_hub_themes
=
[
"gradio/glass"
,
"gradio/monochrome"
,
"gradio/seafoam"
,
"gradio/soft"
,
"freddyaboulton/dracula_revamped"
,
"gradio/dracula_test"
,
"abidlabs/dracula_test"
,
"abidlabs/pakistan"
,
"dawood/microsoft_windows"
,
"ysharma/steampunk"
]
cmd_opts
.
disable_extension_access
=
(
cmd_opts
.
share
or
cmd_opts
.
listen
or
cmd_opts
.
server_name
)
and
not
cmd_opts
.
enable_insecure_extension_access
devices
.
device
,
devices
.
device_interrogate
,
devices
.
device_gfpgan
,
devices
.
device_esrgan
,
devices
.
device_codeformer
=
\
...
...
@@ -394,6 +410,7 @@ options_templates.update(options_section(('ui', "User interface"), {
"ui_reorder"
:
OptionInfo
(
", "
.
join
(
ui_reorder_categories
),
"txt2img/img2img UI item order"
),
"ui_extra_networks_tab_reorder"
:
OptionInfo
(
""
,
"Extra networks tab order"
),
"localization"
:
OptionInfo
(
"None"
,
"Localization (requires restart)"
,
gr
.
Dropdown
,
lambda
:
{
"choices"
:
[
"None"
]
+
list
(
localization
.
localizations
.
keys
())},
refresh
=
lambda
:
localization
.
list_localizations
(
cmd_opts
.
localizations_dir
)),
"gradio_theme"
:
OptionInfo
(
"Default"
,
"Gradio theme (requires restart)"
,
gr
.
Dropdown
,
lambda
:
{
"choices"
:
[
"Default"
]
+
gradio_hf_hub_themes
})
}))
options_templates
.
update
(
options_section
((
'ui'
,
"Live previews"
),
{
...
...
@@ -607,6 +624,24 @@ clip_model = None
progress_print_out
=
sys
.
stdout
gradio_theme
=
gr
.
themes
.
Base
()
def
reload_gradio_theme
(
theme_name
=
None
):
global
gradio_theme
if
not
theme_name
:
theme_name
=
opts
.
gradio_theme
if
theme_name
==
"Default"
:
gradio_theme
=
gr
.
themes
.
Default
()
else
:
try
:
gradio_theme
=
gr
.
themes
.
ThemeClass
.
from_hub
(
theme_name
)
except
requests
.
exceptions
.
ConnectionError
:
print
(
"Can't access HuggingFace Hub, falling back to default Gradio theme"
)
gradio_theme
=
gr
.
themes
.
Default
()
class
TotalTQDM
:
def
__init__
(
self
):
...
...
modules/ui.py
View file @
e018c8a3
...
...
@@ -1565,7 +1565,7 @@ def create_ui():
for
_interface
,
label
,
_ifid
in
interfaces
:
shared
.
tab_names
.
append
(
label
)
with
gr
.
Blocks
(
analytics_enabled
=
False
,
title
=
"Stable Diffusion"
)
as
demo
:
with
gr
.
Blocks
(
theme
=
shared
.
gradio_theme
,
analytics_enabled
=
False
,
title
=
"Stable Diffusion"
)
as
demo
:
with
gr
.
Row
(
elem_id
=
"quicksettings"
,
variant
=
"compact"
):
for
i
,
k
,
item
in
sorted
(
quicksettings_list
,
key
=
lambda
x
:
quicksettings_names
.
get
(
x
[
1
],
x
[
0
])):
component
=
create_setting_component
(
k
,
is_quicksettings
=
True
)
...
...
webui.py
View file @
e018c8a3
...
...
@@ -192,6 +192,7 @@ def initialize():
shared
.
opts
.
onchange
(
"sd_vae"
,
wrap_queued_call
(
lambda
:
modules
.
sd_vae
.
reload_vae_weights
()),
call
=
False
)
shared
.
opts
.
onchange
(
"sd_vae_as_default"
,
wrap_queued_call
(
lambda
:
modules
.
sd_vae
.
reload_vae_weights
()),
call
=
False
)
shared
.
opts
.
onchange
(
"temp_dir"
,
ui_tempdir
.
on_tmpdir_changed
)
shared
.
opts
.
onchange
(
"gradio_theme"
,
shared
.
reload_gradio_theme
)
startup_timer
.
record
(
"opts onchange"
)
shared
.
reload_hypernetworks
()
...
...
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