Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Overbill1683
Stable Diffusion Webui
提交
24e21c07
S
Stable Diffusion Webui
项目概览
Overbill1683
/
Stable Diffusion Webui
12 个月 前同步成功
通知
1771
Star
81
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
分析
仓库
DevOps
项目成员
Pages
S
Stable Diffusion Webui
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Pages
分析
分析
仓库分析
DevOps
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
提交
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
24e21c07
编写于
1月 05, 2023
作者:
A
AUTOMATIC1111
提交者:
GitHub
1月 05, 2023
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #6328 from lolsuffocate/fix-png-info-api
Make pnginfoapi return all image info
上级
2e309974
1288a3bb
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
15 addition
and
6 deletion
+15
-6
modules/api/api.py
modules/api/api.py
+12
-4
modules/api/models.py
modules/api/models.py
+3
-2
未找到文件。
modules/api/api.py
浏览文件 @
24e21c07
...
@@ -11,10 +11,10 @@ from fastapi.security import HTTPBasic, HTTPBasicCredentials
...
@@ -11,10 +11,10 @@ from fastapi.security import HTTPBasic, HTTPBasicCredentials
from
secrets
import
compare_digest
from
secrets
import
compare_digest
import
modules.shared
as
shared
import
modules.shared
as
shared
from
modules
import
sd_samplers
,
deepbooru
,
sd_hijack
from
modules
import
sd_samplers
,
deepbooru
,
sd_hijack
,
images
from
modules.api.models
import
*
from
modules.api.models
import
*
from
modules.processing
import
StableDiffusionProcessingTxt2Img
,
StableDiffusionProcessingImg2Img
,
process_images
from
modules.processing
import
StableDiffusionProcessingTxt2Img
,
StableDiffusionProcessingImg2Img
,
process_images
from
modules.extras
import
run_extras
,
run_pnginfo
from
modules.extras
import
run_extras
from
modules.textual_inversion.textual_inversion
import
create_embedding
,
train_embedding
from
modules.textual_inversion.textual_inversion
import
create_embedding
,
train_embedding
from
modules.textual_inversion.preprocess
import
preprocess
from
modules.textual_inversion.preprocess
import
preprocess
from
modules.hypernetworks.hypernetwork
import
create_hypernetwork
,
train_hypernetwork
from
modules.hypernetworks.hypernetwork
import
create_hypernetwork
,
train_hypernetwork
...
@@ -233,9 +233,17 @@ class Api:
...
@@ -233,9 +233,17 @@ class Api:
if
(
not
req
.
image
.
strip
()):
if
(
not
req
.
image
.
strip
()):
return
PNGInfoResponse
(
info
=
""
)
return
PNGInfoResponse
(
info
=
""
)
result
=
run_pnginfo
(
decode_base64_to_image
(
req
.
image
.
strip
()))
image
=
decode_base64_to_image
(
req
.
image
.
strip
())
if
image
is
None
:
return
PNGInfoResponse
(
info
=
""
)
geninfo
,
items
=
images
.
read_info_from_image
(
image
)
if
geninfo
is
None
:
geninfo
=
""
items
=
{
**
{
'parameters'
:
geninfo
},
**
items
}
return
PNGInfoResponse
(
info
=
result
[
1
]
)
return
PNGInfoResponse
(
info
=
geninfo
,
items
=
items
)
def
progressapi
(
self
,
req
:
ProgressRequest
=
Depends
()):
def
progressapi
(
self
,
req
:
ProgressRequest
=
Depends
()):
# copy from check_progress_call of ui.py
# copy from check_progress_call of ui.py
...
...
modules/api/models.py
浏览文件 @
24e21c07
...
@@ -157,7 +157,8 @@ class PNGInfoRequest(BaseModel):
...
@@ -157,7 +157,8 @@ class PNGInfoRequest(BaseModel):
image
:
str
=
Field
(
title
=
"Image"
,
description
=
"The base64 encoded PNG image"
)
image
:
str
=
Field
(
title
=
"Image"
,
description
=
"The base64 encoded PNG image"
)
class
PNGInfoResponse
(
BaseModel
):
class
PNGInfoResponse
(
BaseModel
):
info
:
str
=
Field
(
title
=
"Image info"
,
description
=
"A string with all the info the image had"
)
info
:
str
=
Field
(
title
=
"Image info"
,
description
=
"A string with the parameters used to generate the image"
)
items
:
dict
=
Field
(
title
=
"Items"
,
description
=
"An object containing all the info the image had"
)
class
ProgressRequest
(
BaseModel
):
class
ProgressRequest
(
BaseModel
):
skip_current_image
:
bool
=
Field
(
default
=
False
,
title
=
"Skip current image"
,
description
=
"Skip current image serialization"
)
skip_current_image
:
bool
=
Field
(
default
=
False
,
title
=
"Skip current image"
,
description
=
"Skip current image serialization"
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录