aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhilpax <me@philpax.me>2022-12-25 10:45:44 +0000
committerPhilpax <me@philpax.me>2022-12-25 10:45:44 +0000
commit5be9387b230794a8c771120577cb213490c940c0 (patch)
tree2370f9103b50da0582fdb7a3231546712f5bb438
parentc6f347b81f584b6c0d44af7a209983284dbb52d2 (diff)
downloadstable-diffusion-webui-gfx803-5be9387b230794a8c771120577cb213490c940c0.tar.gz
stable-diffusion-webui-gfx803-5be9387b230794a8c771120577cb213490c940c0.tar.bz2
stable-diffusion-webui-gfx803-5be9387b230794a8c771120577cb213490c940c0.zip
fix(api): only begin/end state in lock
-rw-r--r--modules/api/api.py12
1 files changed, 4 insertions, 8 deletions
diff --git a/modules/api/api.py b/modules/api/api.py
index 1ceba75d..59b81c93 100644
--- a/modules/api/api.py
+++ b/modules/api/api.py
@@ -130,14 +130,12 @@ class Api:
if populate.sampler_name:
populate.sampler_index = None # prevent a warning later on
p = StableDiffusionProcessingTxt2Img(**vars(populate))
- # Override object param
-
- shared.state.begin()
with self.queue_lock:
+ shared.state.begin()
processed = process_images(p)
+ shared.state.end()
- shared.state.end()
b64images = list(map(encode_pil_to_base64, processed.images))
@@ -169,12 +167,10 @@ class Api:
p.init_images = [decode_base64_to_image(x) for x in init_images]
- shared.state.begin()
-
with self.queue_lock:
+ shared.state.begin()
processed = process_images(p)
-
- shared.state.end()
+ shared.state.end()
b64images = list(map(encode_pil_to_base64, processed.images))