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
2174f58d
Commit
2174f58d
authored
Mar 11, 2023
by
Vespinian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Changed alwayson_script_name and alwayson_script_args api params to 1 alwayson_scripts param dict
parent
c6c2a593
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
18 deletions
+9
-18
modules/api/api.py
modules/api/api.py
+7
-16
modules/api/models.py
modules/api/models.py
+2
-2
No files found.
modules/api/api.py
View file @
2174f58d
...
...
@@ -195,22 +195,17 @@ class Api:
script_args
[
0
]
=
0
# Now check for always on scripts
if
request
.
alwayson_script_name
and
(
len
(
request
.
alwayson_script_name
)
>
0
):
# always on script with no arg should always run, but if you include their name in the api request, send an empty list for there args
if
not
request
.
alwayson_script_args
:
raise
HTTPException
(
status_code
=
422
,
detail
=
f
"Script {request.alwayson_script_name} has no arg list"
)
if
len
(
request
.
alwayson_script_name
)
!=
len
(
request
.
alwayson_script_args
):
raise
HTTPException
(
status_code
=
422
,
detail
=
f
"Number of script names and number of script arg lists doesn't match"
)
for
alwayson_script_name
,
alwayson_script_args
in
zip
(
request
.
alwayson_script_name
,
request
.
alwayson_script_args
):
if
request
.
alwayson_scripts
and
(
len
(
request
.
alwayson_scripts
)
>
0
):
for
alwayson_script_name
in
request
.
alwayson_scripts
.
keys
():
alwayson_script
=
self
.
get_script
(
alwayson_script_name
,
script_runner
)
if
alwayson_script
==
None
:
raise
HTTPException
(
status_code
=
422
,
detail
=
f
"always on script {alwayson_script_name} not found"
)
# Selectable script in always on script param check
if
alwayson_script
.
alwayson
==
False
:
raise
HTTPException
(
status_code
=
422
,
detail
=
f
"Cannot have a selectable script in the always on scripts params"
)
if
alwayson_script_args
!=
[]:
script_args
[
alwayson_script
.
args_from
:
alwayson_script
.
args_to
]
=
alwayson_script_args
# always on script with no arg should always run so you don't really need to add them to the requests
if
"args"
in
request
.
alwayson_scripts
[
alwayson_script_name
]:
script_args
[
alwayson_script
.
args_from
:
alwayson_script
.
args_to
]
=
request
.
alwayson_scripts
[
alwayson_script_name
][
"args"
]
return
script_args
def
text2imgapi
(
self
,
txt2imgreq
:
StableDiffusionTxt2ImgProcessingAPI
):
...
...
@@ -226,15 +221,13 @@ class Api:
"do_not_save_grid"
:
True
}
)
if
populate
.
sampler_name
:
populate
.
sampler_index
=
None
# prevent a warning later on
args
=
vars
(
populate
)
args
.
pop
(
'script_name'
,
None
)
args
.
pop
(
'script_args'
,
None
)
# will refeed them to the pipeline directly after initializing them
args
.
pop
(
'alwayson_script_name'
,
None
)
args
.
pop
(
'alwayson_script_args'
,
None
)
args
.
pop
(
'alwayson_scripts'
,
None
)
script_args
=
self
.
init_script_args
(
txt2imgreq
,
selectable_scripts
,
selectable_script_idx
,
script_runner
)
...
...
@@ -279,7 +272,6 @@ class Api:
"mask"
:
mask
}
)
if
populate
.
sampler_name
:
populate
.
sampler_index
=
None
# prevent a warning later on
...
...
@@ -287,8 +279,7 @@ class Api:
args
.
pop
(
'include_init_images'
,
None
)
# this is meant to be done by "exclude": True in model, but it's for a reason that I cannot determine.
args
.
pop
(
'script_name'
,
None
)
args
.
pop
(
'script_args'
,
None
)
# will refeed them to the pipeline directly after initializing them
args
.
pop
(
'alwayson_script_name'
,
None
)
args
.
pop
(
'alwayson_script_args'
,
None
)
args
.
pop
(
'alwayson_scripts'
,
None
)
script_args
=
self
.
init_script_args
(
img2imgreq
,
selectable_scripts
,
selectable_script_idx
,
script_runner
)
...
...
modules/api/models.py
View file @
2174f58d
...
...
@@ -100,13 +100,13 @@ class PydanticModelGenerator:
StableDiffusionTxt2ImgProcessingAPI
=
PydanticModelGenerator
(
"StableDiffusionProcessingTxt2Img"
,
StableDiffusionProcessingTxt2Img
,
[{
"key"
:
"sampler_index"
,
"type"
:
str
,
"default"
:
"Euler"
},
{
"key"
:
"script_name"
,
"type"
:
str
,
"default"
:
None
},
{
"key"
:
"script_args"
,
"type"
:
list
,
"default"
:
[]},
{
"key"
:
"alwayson_script
_name"
,
"type"
:
list
,
"default"
:
[]},
{
"key"
:
"alwayson_script_args"
,
"type"
:
list
,
"default"
:
[]
}]
[{
"key"
:
"sampler_index"
,
"type"
:
str
,
"default"
:
"Euler"
},
{
"key"
:
"script_name"
,
"type"
:
str
,
"default"
:
None
},
{
"key"
:
"script_args"
,
"type"
:
list
,
"default"
:
[]},
{
"key"
:
"alwayson_script
s"
,
"type"
:
dict
,
"default"
:
{}
}]
)
.
generate_model
()
StableDiffusionImg2ImgProcessingAPI
=
PydanticModelGenerator
(
"StableDiffusionProcessingImg2Img"
,
StableDiffusionProcessingImg2Img
,
[{
"key"
:
"sampler_index"
,
"type"
:
str
,
"default"
:
"Euler"
},
{
"key"
:
"init_images"
,
"type"
:
list
,
"default"
:
None
},
{
"key"
:
"denoising_strength"
,
"type"
:
float
,
"default"
:
0.75
},
{
"key"
:
"mask"
,
"type"
:
str
,
"default"
:
None
},
{
"key"
:
"include_init_images"
,
"type"
:
bool
,
"default"
:
False
,
"exclude"
:
True
},
{
"key"
:
"script_name"
,
"type"
:
str
,
"default"
:
None
},
{
"key"
:
"script_args"
,
"type"
:
list
,
"default"
:
[]},
{
"key"
:
"alwayson_script
_name"
,
"type"
:
list
,
"default"
:
[]},
{
"key"
:
"alwayson_script_args"
,
"type"
:
list
,
"default"
:
[]
}]
[{
"key"
:
"sampler_index"
,
"type"
:
str
,
"default"
:
"Euler"
},
{
"key"
:
"init_images"
,
"type"
:
list
,
"default"
:
None
},
{
"key"
:
"denoising_strength"
,
"type"
:
float
,
"default"
:
0.75
},
{
"key"
:
"mask"
,
"type"
:
str
,
"default"
:
None
},
{
"key"
:
"include_init_images"
,
"type"
:
bool
,
"default"
:
False
,
"exclude"
:
True
},
{
"key"
:
"script_name"
,
"type"
:
str
,
"default"
:
None
},
{
"key"
:
"script_args"
,
"type"
:
list
,
"default"
:
[]},
{
"key"
:
"alwayson_script
s"
,
"type"
:
dict
,
"default"
:
{}
}]
)
.
generate_model
()
class
TextToImageResponse
(
BaseModel
):
...
...
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