Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Overbill1683
Stable Diffusion Webui
提交
08c68820
S
Stable Diffusion Webui
项目概览
Overbill1683
/
Stable Diffusion Webui
9 个月 前同步成功
通知
1727
Star
80
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
分析
仓库
DevOps
项目成员
Pages
S
Stable Diffusion Webui
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Pages
分析
分析
仓库分析
DevOps
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
提交
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
08c68820
编写于
11月 27, 2023
作者:
W
w-e-w
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
gradio 3.41.2 attempt
上级
f0f100e6
变更
6
显示空白变更内容
内联
并排
Showing
6 changed file
with
78 addition
and
9 deletion
+78
-9
modules/api/models.py
modules/api/models.py
+2
-2
modules/gradio_extensons.py
modules/gradio_extensons.py
+70
-1
modules/ui.py
modules/ui.py
+2
-2
modules/ui_tempdir.py
modules/ui_tempdir.py
+1
-1
requirements.txt
requirements.txt
+1
-1
requirements_versions.txt
requirements_versions.txt
+2
-2
未找到文件。
modules/api/models.py
浏览文件 @
08c68820
...
...
@@ -93,8 +93,8 @@ class PydanticModelGenerator:
d
.
field
:
(
d
.
field_type
,
Field
(
default
=
d
.
field_value
,
alias
=
d
.
field_alias
,
exclude
=
d
.
field_exclude
))
for
d
in
self
.
_model_def
}
DynamicModel
=
create_model
(
self
.
_model_name
,
**
fields
)
DynamicModel
.
__config__
.
allow_population_by_field_name
=
True
DynamicModel
.
__config__
.
allow_mutation
=
True
DynamicModel
.
model_config
[
'populate_by_name'
]
=
True
DynamicModel
.
model_config
[
'frozen'
]
=
True
return
DynamicModel
StableDiffusionTxt2ImgProcessingAPI
=
PydanticModelGenerator
(
...
...
modules/gradio_extensons.py
浏览文件 @
08c68820
from
inspect
import
signature
from
functools
import
wraps
import
gradio
as
gr
from
modules
import
scripts
,
ui_tempdir
,
patches
...
...
@@ -64,10 +66,77 @@ def Blocks_get_config_file(self, *args, **kwargs):
return
config
original_IOComponent_init
=
patches
.
patch
(
__name__
,
obj
=
gr
.
components
.
IOComponent
,
field
=
"__init__"
,
replacement
=
IOComponent_init
)
def
gradio_component_compatibility_layer
(
component_function
):
@
wraps
(
component_function
)
def
patched_function
(
*
args
,
**
kwargs
):
original_signature
=
signature
(
component_function
).
parameters
valid_kwargs
=
{
k
:
v
for
k
,
v
in
kwargs
.
items
()
if
k
in
original_signature
}
result
=
component_function
(
*
args
,
**
valid_kwargs
)
return
result
return
patched_function
sub_events
=
[
'then'
,
'success'
]
def
gradio_component_events_compatibility_layer
(
component_function
):
@
wraps
(
component_function
)
def
patched_function
(
*
args
,
**
kwargs
):
kwargs
[
'js'
]
=
kwargs
.
get
(
'js'
,
kwargs
.
pop
(
'_js'
,
None
))
original_signature
=
signature
(
component_function
).
parameters
valid_kwargs
=
{
k
:
v
for
k
,
v
in
kwargs
.
items
()
if
k
in
original_signature
}
result
=
component_function
(
*
args
,
**
valid_kwargs
)
for
sub_event
in
sub_events
:
component_event_then_function
=
getattr
(
result
,
sub_event
,
None
)
if
component_event_then_function
:
patched_component_event_then_function
=
gradio_component_sub_events_compatibility_layer
(
component_event_then_function
)
setattr
(
result
,
sub_event
,
patched_component_event_then_function
)
# original_component_event_then_function = patches.patch(f'{__name__}.', obj=result, field='then', replacement=patched_component_event_then_function)
return
result
return
patched_function
def
gradio_component_sub_events_compatibility_layer
(
component_function
):
@
wraps
(
component_function
)
def
patched_function
(
*
args
,
**
kwargs
):
kwargs
[
'js'
]
=
kwargs
.
get
(
'js'
,
kwargs
.
pop
(
'_js'
,
None
))
original_signature
=
signature
(
component_function
).
parameters
valid_kwargs
=
{
k
:
v
for
k
,
v
in
kwargs
.
items
()
if
k
in
original_signature
}
result
=
component_function
(
*
args
,
**
valid_kwargs
)
return
result
return
patched_function
for
component_name
in
set
(
gr
.
components
.
__all__
+
gr
.
layouts
.
__all__
):
try
:
component
=
getattr
(
gr
,
component_name
)
component_init
=
getattr
(
component
,
'__init__'
)
patched_component_init
=
gradio_component_compatibility_layer
(
component_init
)
original_IOComponent_init
=
patches
.
patch
(
f
'
{
__name__
}
.
{
component_name
}
'
,
obj
=
component
,
field
=
"__init__"
,
replacement
=
patched_component_init
)
component_events
=
set
(
getattr
(
component
,
'EVENTS'
))
for
component_event
in
component_events
:
component_event_function
=
getattr
(
component
,
component_event
)
patched_component_event_function
=
gradio_component_events_compatibility_layer
(
component_event_function
)
original_component_event_function
=
patches
.
patch
(
f
'
{
__name__
}
.
{
component_name
}
.
{
component_event
}
'
,
obj
=
component
,
field
=
component_event
,
replacement
=
patched_component_event_function
)
except
Exception
as
e
:
print
(
e
)
pass
gr
.
Box
=
gr
.
Group
original_IOComponent_init
=
patches
.
patch
(
__name__
,
obj
=
gr
.
components
.
base
.
Component
,
field
=
"__init__"
,
replacement
=
IOComponent_init
)
original_Block_get_config
=
patches
.
patch
(
__name__
,
obj
=
gr
.
blocks
.
Block
,
field
=
"get_config"
,
replacement
=
Block_get_config
)
original_BlockContext_init
=
patches
.
patch
(
__name__
,
obj
=
gr
.
blocks
.
BlockContext
,
field
=
"__init__"
,
replacement
=
BlockContext_init
)
original_Blocks_get_config_file
=
patches
.
patch
(
__name__
,
obj
=
gr
.
blocks
.
Blocks
,
field
=
"get_config_file"
,
replacement
=
Blocks_get_config_file
)
ui_tempdir
.
install_ui_tempdir_override
()
modules/ui.py
浏览文件 @
08c68820
...
...
@@ -32,8 +32,8 @@ from modules.generation_parameters_copypaste import image_from_url_text
create_setting_component
=
ui_settings
.
create_setting_component
warnings
.
filterwarnings
(
"default"
if
opts
.
show_warnings
else
"ignore"
,
category
=
UserWarning
)
warnings
.
filterwarnings
(
"default"
if
opts
.
show_gradio_deprecation_warnings
else
"ignore"
,
category
=
gr
.
deprecation
.
GradioDeprecationWarning
)
#
warnings.filterwarnings("default" if opts.show_warnings else "ignore", category=UserWarning)
#
warnings.filterwarnings("default" if opts.show_gradio_deprecation_warnings else "ignore", category=gr.deprecation.GradioDeprecationWarning)
# this is a fix for Windows users. Without it, javascript files will be served with text/html content-type and the browser will not show any UI
mimetypes
.
init
()
...
...
modules/ui_tempdir.py
浏览文件 @
08c68820
...
...
@@ -61,7 +61,7 @@ def save_pil_to_file(self, pil_image, dir=None, format="png"):
def
install_ui_tempdir_override
():
"""override save to file function so that it also writes PNG info"""
gradio
.
components
.
IOComponent
.
pil_to_temp_file
=
save_pil_to_file
#
gradio.components.IOComponent.pil_to_temp_file = save_pil_to_file
def
on_tmpdir_changed
():
...
...
requirements.txt
浏览文件 @
08c68820
...
...
@@ -8,7 +8,7 @@ clean-fid
einops
fastapi
>=0.90.1
gfpgan
gradio
==
3.41.2
gradio
==
4.7.1
inflection
jsonmerge
kornia
...
...
requirements_versions.txt
浏览文件 @
08c68820
...
...
@@ -5,9 +5,9 @@ basicsr==1.4.2
blendmodes==2022
clean-fid==0.1.35
einops==0.4.1
fastapi==0.
94.0
fastapi==0.
104.1
gfpgan==1.3.8
gradio==
3.41.2
gradio==
4.7.1
httpcore==0.15
inflection==0.5.1
jsonmerge==1.8.0
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录