mirror of
https://github.com/openvinotoolkit/stable-diffusion-webui.git
synced 2024-12-15 07:03:06 +03:00
[bug] If txt2img/img2img raises an exception, finally call state.end()
Signed-off-by: AnyISalIn <anyisalin@gmail.com>
This commit is contained in:
parent
075934a944
commit
1fe2dcaa2a
@ -333,14 +333,16 @@ class Api:
|
|||||||
p.outpath_grids = opts.outdir_txt2img_grids
|
p.outpath_grids = opts.outdir_txt2img_grids
|
||||||
p.outpath_samples = opts.outdir_txt2img_samples
|
p.outpath_samples = opts.outdir_txt2img_samples
|
||||||
|
|
||||||
shared.state.begin(job="scripts_txt2img")
|
try:
|
||||||
if selectable_scripts is not None:
|
shared.state.begin(job="scripts_txt2img")
|
||||||
p.script_args = script_args
|
if selectable_scripts is not None:
|
||||||
processed = scripts.scripts_txt2img.run(p, *p.script_args) # Need to pass args as list here
|
p.script_args = script_args
|
||||||
else:
|
processed = scripts.scripts_txt2img.run(p, *p.script_args) # Need to pass args as list here
|
||||||
p.script_args = tuple(script_args) # Need to pass args as tuple here
|
else:
|
||||||
processed = process_images(p)
|
p.script_args = tuple(script_args) # Need to pass args as tuple here
|
||||||
shared.state.end()
|
processed = process_images(p)
|
||||||
|
finally:
|
||||||
|
shared.state.end()
|
||||||
|
|
||||||
b64images = list(map(encode_pil_to_base64, processed.images)) if send_images else []
|
b64images = list(map(encode_pil_to_base64, processed.images)) if send_images else []
|
||||||
|
|
||||||
@ -390,14 +392,16 @@ class Api:
|
|||||||
p.outpath_grids = opts.outdir_img2img_grids
|
p.outpath_grids = opts.outdir_img2img_grids
|
||||||
p.outpath_samples = opts.outdir_img2img_samples
|
p.outpath_samples = opts.outdir_img2img_samples
|
||||||
|
|
||||||
shared.state.begin(job="scripts_img2img")
|
try:
|
||||||
if selectable_scripts is not None:
|
shared.state.begin(job="scripts_img2img")
|
||||||
p.script_args = script_args
|
if selectable_scripts is not None:
|
||||||
processed = scripts.scripts_img2img.run(p, *p.script_args) # Need to pass args as list here
|
p.script_args = script_args
|
||||||
else:
|
processed = scripts.scripts_img2img.run(p, *p.script_args) # Need to pass args as list here
|
||||||
p.script_args = tuple(script_args) # Need to pass args as tuple here
|
else:
|
||||||
processed = process_images(p)
|
p.script_args = tuple(script_args) # Need to pass args as tuple here
|
||||||
shared.state.end()
|
processed = process_images(p)
|
||||||
|
finally:
|
||||||
|
shared.state.end()
|
||||||
|
|
||||||
b64images = list(map(encode_pil_to_base64, processed.images)) if send_images else []
|
b64images = list(map(encode_pil_to_base64, processed.images)) if send_images else []
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user