Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix API thread safe issues of txt2img and img2img #14421

Merged
merged 5 commits into from
Dec 30, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix format issue
  • Loading branch information
lanyeeee committed Dec 30, 2023
commit 91560e98c47f8271d444556ef4ae6505dece9aba
6 changes: 2 additions & 4 deletions modules/api/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,6 @@ def text2imgapi(self, txt2imgreq: models.StableDiffusionTxt2ImgProcessingAPI):
task_id = txt2imgreq.force_task_id or create_task_id("txt2img")

script_runner = scripts.scripts_txt2img

with self.txt2img_script_arg_init_lock:
if not script_runner.scripts:
script_runner.initialize_scripts(False)
Expand Down Expand Up @@ -489,14 +488,13 @@ def img2imgapi(self, img2imgreq: models.StableDiffusionImg2ImgProcessingAPI):
mask = decode_base64_to_image(mask)

script_runner = scripts.scripts_img2img

with self.img2img_script_arg_init_lock:
if not script_runner.scripts:
script_runner.initialize_scripts(True)
ui.create_ui()

infotext_script_args = {}
self.apply_infotext(img2imgreq, "img2img", script_runner=script_runner, mentioned_script_args=infotext_script_args)
infotext_script_args = {}
self.apply_infotext(img2imgreq, "img2img", script_runner=script_runner, mentioned_script_args=infotext_script_args)

if not self.default_script_arg_img2img:
self.default_script_arg_img2img = self.init_default_script_args(script_runner)
Expand Down