diff options
author | AUTOMATIC1111 <16777216c@gmail.com> | 2023-07-10 17:41:09 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-10 17:41:09 +0000 |
commit | 910d4f61e5a08c620dd5010665815e2694a55d11 (patch) | |
tree | ad0a26e126a57d97bee3b86ab238e31738d1a36f /modules/txt2img.py | |
parent | bcb6ad5fab6fb59fc79c8b6d94699cbabec34297 (diff) | |
parent | 44c27ebc7393ea793245aa565ace6c9bf1313980 (diff) | |
download | stable-diffusion-webui-gfx803-910d4f61e5a08c620dd5010665815e2694a55d11.tar.gz stable-diffusion-webui-gfx803-910d4f61e5a08c620dd5010665815e2694a55d11.tar.bz2 stable-diffusion-webui-gfx803-910d4f61e5a08c620dd5010665815e2694a55d11.zip |
Merge pull request #11720 from akx/closing
Use closing() with processing classes everywhere
Diffstat (limited to 'modules/txt2img.py')
-rw-r--r-- | modules/txt2img.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/modules/txt2img.py b/modules/txt2img.py index 6aa79f23..d0be2e73 100644 --- a/modules/txt2img.py +++ b/modules/txt2img.py @@ -1,3 +1,5 @@ +from contextlib import closing
+
import modules.scripts
from modules import sd_samplers, processing
from modules.generation_parameters_copypaste import create_override_settings_dict
@@ -53,12 +55,11 @@ def txt2img(id_task: str, prompt: str, negative_prompt: str, prompt_styles, step if cmd_opts.enable_console_prompts:
print(f"\ntxt2img: {prompt}", file=shared.progress_print_out)
- processed = modules.scripts.scripts_txt2img.run(p, *args)
-
- if processed is None:
- processed = processing.process_images(p)
+ with closing(p):
+ processed = modules.scripts.scripts_txt2img.run(p, *args)
- p.close()
+ if processed is None:
+ processed = processing.process_images(p)
shared.total_tqdm.clear()
|