Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
S
stable-diffusion-webui
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
stable-diffusion-webui
Commits
84a6f211
Unverified
Commit
84a6f211
authored
Nov 19, 2022
by
AUTOMATIC1111
Committed by
GitHub
Nov 19, 2022
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4358 from bamarillo/master
[API][Feature] Add Skip endpoint
parents
4b22ec41
7f63980e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
11 deletions
+11
-11
api.py
modules/api/api.py
+8
-8
models.py
modules/api/models.py
+3
-3
No files found.
modules/api/api.py
View file @
84a6f211
...
@@ -72,6 +72,7 @@ class Api:
...
@@ -72,6 +72,7 @@ class Api:
self
.
app
.
add_api_route
(
"/sdapi/v1/progress"
,
self
.
progressapi
,
methods
=
[
"GET"
],
response_model
=
ProgressResponse
)
self
.
app
.
add_api_route
(
"/sdapi/v1/progress"
,
self
.
progressapi
,
methods
=
[
"GET"
],
response_model
=
ProgressResponse
)
self
.
app
.
add_api_route
(
"/sdapi/v1/interrogate"
,
self
.
interrogateapi
,
methods
=
[
"POST"
])
self
.
app
.
add_api_route
(
"/sdapi/v1/interrogate"
,
self
.
interrogateapi
,
methods
=
[
"POST"
])
self
.
app
.
add_api_route
(
"/sdapi/v1/interrupt"
,
self
.
interruptapi
,
methods
=
[
"POST"
])
self
.
app
.
add_api_route
(
"/sdapi/v1/interrupt"
,
self
.
interruptapi
,
methods
=
[
"POST"
])
self
.
app
.
add_api_route
(
"/sdapi/v1/skip"
,
self
.
skip
,
methods
=
[
"POST"
])
self
.
app
.
add_api_route
(
"/sdapi/v1/options"
,
self
.
get_config
,
methods
=
[
"GET"
],
response_model
=
OptionsModel
)
self
.
app
.
add_api_route
(
"/sdapi/v1/options"
,
self
.
get_config
,
methods
=
[
"GET"
],
response_model
=
OptionsModel
)
self
.
app
.
add_api_route
(
"/sdapi/v1/options"
,
self
.
set_config
,
methods
=
[
"POST"
])
self
.
app
.
add_api_route
(
"/sdapi/v1/options"
,
self
.
set_config
,
methods
=
[
"POST"
])
self
.
app
.
add_api_route
(
"/sdapi/v1/cmd-flags"
,
self
.
get_cmd_flags
,
methods
=
[
"GET"
],
response_model
=
FlagsModel
)
self
.
app
.
add_api_route
(
"/sdapi/v1/cmd-flags"
,
self
.
get_cmd_flags
,
methods
=
[
"GET"
],
response_model
=
FlagsModel
)
...
@@ -237,6 +238,9 @@ class Api:
...
@@ -237,6 +238,9 @@ class Api:
return
{}
return
{}
def
skip
(
self
):
shared
.
state
.
skip
()
def
get_config
(
self
):
def
get_config
(
self
):
options
=
{}
options
=
{}
for
key
in
shared
.
opts
.
data
.
keys
():
for
key
in
shared
.
opts
.
data
.
keys
():
...
@@ -248,14 +252,10 @@ class Api:
...
@@ -248,14 +252,10 @@ class Api:
return
options
return
options
def
set_config
(
self
,
req
:
OptionsModel
):
def
set_config
(
self
,
req
:
Dict
[
str
,
Any
]):
# currently req has all options fields even if you send a dict like { "send_seed": false }, which means it will
# overwrite all options with default values.
for
o
in
req
:
raise
RuntimeError
(
'Setting options via API is not supported'
)
setattr
(
shared
.
opts
,
o
,
req
[
o
])
reqDict
=
vars
(
req
)
for
o
in
reqDict
:
setattr
(
shared
.
opts
,
o
,
reqDict
[
o
])
shared
.
opts
.
save
(
shared
.
config_filename
)
shared
.
opts
.
save
(
shared
.
config_filename
)
return
return
...
...
modules/api/models.py
View file @
84a6f211
...
@@ -176,9 +176,9 @@ class InterrogateResponse(BaseModel):
...
@@ -176,9 +176,9 @@ class InterrogateResponse(BaseModel):
caption
:
str
=
Field
(
default
=
None
,
title
=
"Caption"
,
description
=
"The generated caption for the image."
)
caption
:
str
=
Field
(
default
=
None
,
title
=
"Caption"
,
description
=
"The generated caption for the image."
)
fields
=
{}
fields
=
{}
for
key
,
value
in
opts
.
data
.
items
():
for
key
,
metadata
in
opts
.
data_labels
.
items
():
metadata
=
opts
.
data_labels
.
get
(
key
)
value
=
opts
.
data
.
get
(
key
)
optType
=
opts
.
typemap
.
get
(
type
(
value
),
type
(
value
))
optType
=
opts
.
typemap
.
get
(
type
(
metadata
.
default
),
type
(
value
))
if
(
metadata
is
not
None
):
if
(
metadata
is
not
None
):
fields
.
update
({
key
:
(
Optional
[
optType
],
Field
(
fields
.
update
({
key
:
(
Optional
[
optType
],
Field
(
...
...
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