Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Overbill1683
Stable Diffusion Webui
提交
c9647c8d
S
Stable Diffusion Webui
项目概览
Overbill1683
/
Stable Diffusion Webui
10 个月 前同步成功
通知
1748
Star
81
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
分析
仓库
DevOps
项目成员
Pages
S
Stable Diffusion Webui
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Pages
分析
分析
仓库分析
DevOps
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
提交
体验新版 GitCode,发现更多精彩内容 >>
提交
c9647c8d
编写于
3月 25, 2023
作者:
S
space-nuko
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Support Gradio's theme API
上级
a0d07fb5
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
37 addition
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
未找到文件。
modules/shared.py
浏览文件 @
c9647c8d
...
...
@@ -4,6 +4,7 @@ import json
import
os
import
sys
import
time
import
requests
from
PIL
import
Image
import
gradio
as
gr
...
...
@@ -54,6 +55,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
=
\
...
...
@@ -387,6 +403,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"
),
{
...
...
@@ -599,6 +616,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
浏览文件 @
c9647c8d
...
...
@@ -1592,7 +1592,7 @@ def create_ui():
for
_interface
,
label
,
_ifid
in
interfaces
:
shared
.
tab_names
.
append
(
label
)
with
gr
.
Blocks
(
css
=
css
,
analytics_enabled
=
False
,
title
=
"Stable Diffusion"
)
as
demo
:
with
gr
.
Blocks
(
css
=
css
,
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
浏览文件 @
c9647c8d
...
...
@@ -150,6 +150,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
()
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录