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
00d4a4d4
Commit
00d4a4d4
authored
Dec 26, 2023
by
lanyeeee
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
move thread-unsafe code to __init__
parent
de03882d
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
10 deletions
+9
-10
modules/api/api.py
modules/api/api.py
+9
-10
No files found.
modules/api/api.py
View file @
00d4a4d4
...
@@ -251,6 +251,15 @@ class Api:
...
@@ -251,6 +251,15 @@ class Api:
self
.
default_script_arg_txt2img
=
[]
self
.
default_script_arg_txt2img
=
[]
self
.
default_script_arg_img2img
=
[]
self
.
default_script_arg_img2img
=
[]
script_runner
=
scripts
.
scripts_img2img
if
not
script_runner
.
scripts
:
script_runner
.
initialize_scripts
(
True
)
ui
.
create_ui
()
if
not
self
.
default_script_arg_txt2img
:
self
.
default_script_arg_txt2img
=
self
.
init_default_script_args
(
script_runner
)
if
not
self
.
default_script_arg_img2img
:
self
.
default_script_arg_img2img
=
self
.
init_default_script_args
(
script_runner
)
def
add_api_route
(
self
,
path
:
str
,
endpoint
,
**
kwargs
):
def
add_api_route
(
self
,
path
:
str
,
endpoint
,
**
kwargs
):
if
shared
.
cmd_opts
.
api_auth
:
if
shared
.
cmd_opts
.
api_auth
:
return
self
.
app
.
add_api_route
(
path
,
endpoint
,
dependencies
=
[
Depends
(
self
.
auth
)],
**
kwargs
)
return
self
.
app
.
add_api_route
(
path
,
endpoint
,
dependencies
=
[
Depends
(
self
.
auth
)],
**
kwargs
)
...
@@ -339,11 +348,6 @@ class Api:
...
@@ -339,11 +348,6 @@ class Api:
task_id
=
txt2imgreq
.
force_task_id
or
create_task_id
(
"txt2img"
)
task_id
=
txt2imgreq
.
force_task_id
or
create_task_id
(
"txt2img"
)
script_runner
=
scripts
.
scripts_txt2img
script_runner
=
scripts
.
scripts_txt2img
if
not
script_runner
.
scripts
:
script_runner
.
initialize_scripts
(
False
)
ui
.
create_ui
()
if
not
self
.
default_script_arg_txt2img
:
self
.
default_script_arg_txt2img
=
self
.
init_default_script_args
(
script_runner
)
selectable_scripts
,
selectable_script_idx
=
self
.
get_selectable_script
(
txt2imgreq
.
script_name
,
script_runner
)
selectable_scripts
,
selectable_script_idx
=
self
.
get_selectable_script
(
txt2imgreq
.
script_name
,
script_runner
)
populate
=
txt2imgreq
.
copy
(
update
=
{
# Override __init__ params
populate
=
txt2imgreq
.
copy
(
update
=
{
# Override __init__ params
...
@@ -403,11 +407,6 @@ class Api:
...
@@ -403,11 +407,6 @@ class Api:
mask
=
decode_base64_to_image
(
mask
)
mask
=
decode_base64_to_image
(
mask
)
script_runner
=
scripts
.
scripts_img2img
script_runner
=
scripts
.
scripts_img2img
if
not
script_runner
.
scripts
:
script_runner
.
initialize_scripts
(
True
)
ui
.
create_ui
()
if
not
self
.
default_script_arg_img2img
:
self
.
default_script_arg_img2img
=
self
.
init_default_script_args
(
script_runner
)
selectable_scripts
,
selectable_script_idx
=
self
.
get_selectable_script
(
img2imgreq
.
script_name
,
script_runner
)
selectable_scripts
,
selectable_script_idx
=
self
.
get_selectable_script
(
img2imgreq
.
script_name
,
script_runner
)
populate
=
img2imgreq
.
copy
(
update
=
{
# Override __init__ params
populate
=
img2imgreq
.
copy
(
update
=
{
# Override __init__ params
...
...
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