fix(api): only begin/end state in lock
This commit is contained in:
parent
c6f347b81f
commit
5be9387b23
@ -130,15 +130,13 @@ class Api:
|
|||||||
if populate.sampler_name:
|
if populate.sampler_name:
|
||||||
populate.sampler_index = None # prevent a warning later on
|
populate.sampler_index = None # prevent a warning later on
|
||||||
p = StableDiffusionProcessingTxt2Img(**vars(populate))
|
p = StableDiffusionProcessingTxt2Img(**vars(populate))
|
||||||
# Override object param
|
|
||||||
|
|
||||||
shared.state.begin()
|
|
||||||
|
|
||||||
with self.queue_lock:
|
with self.queue_lock:
|
||||||
|
shared.state.begin()
|
||||||
processed = process_images(p)
|
processed = process_images(p)
|
||||||
|
|
||||||
shared.state.end()
|
shared.state.end()
|
||||||
|
|
||||||
|
|
||||||
b64images = list(map(encode_pil_to_base64, processed.images))
|
b64images = list(map(encode_pil_to_base64, processed.images))
|
||||||
|
|
||||||
return TextToImageResponse(images=b64images, parameters=vars(txt2imgreq), info=processed.js())
|
return TextToImageResponse(images=b64images, parameters=vars(txt2imgreq), info=processed.js())
|
||||||
@ -169,11 +167,9 @@ class Api:
|
|||||||
|
|
||||||
p.init_images = [decode_base64_to_image(x) for x in init_images]
|
p.init_images = [decode_base64_to_image(x) for x in init_images]
|
||||||
|
|
||||||
shared.state.begin()
|
|
||||||
|
|
||||||
with self.queue_lock:
|
with self.queue_lock:
|
||||||
|
shared.state.begin()
|
||||||
processed = process_images(p)
|
processed = process_images(p)
|
||||||
|
|
||||||
shared.state.end()
|
shared.state.end()
|
||||||
|
|
||||||
b64images = list(map(encode_pil_to_base64, processed.images))
|
b64images = list(map(encode_pil_to_base64, processed.images))
|
||||||
|
Loading…
Reference in New Issue
Block a user