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
24e21c07
Commit
24e21c07
authored
Jan 05, 2023
by
AUTOMATIC1111
Committed by
GitHub
Jan 05, 2023
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #6328 from lolsuffocate/fix-png-info-api
Make pnginfoapi return all image info
parents
2e309974
1288a3bb
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
6 deletions
+15
-6
modules/api/api.py
modules/api/api.py
+12
-4
modules/api/models.py
modules/api/models.py
+3
-2
No files found.
modules/api/api.py
View file @
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
View file @
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"
)
...
...
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