From b69072d382b4c120160fac70b1973291df4711fc Mon Sep 17 00:00:00 2001 From: Bryce Date: Sat, 24 Sep 2022 11:21:53 -0700 Subject: [PATCH] fix: various bugfixes --- imaginairy/api.py | 6 +++--- imaginairy/cmds.py | 9 +++++---- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/imaginairy/api.py b/imaginairy/api.py index 6db5c1a..125954e 100755 --- a/imaginairy/api.py +++ b/imaginairy/api.py @@ -95,7 +95,8 @@ def imagine_image_files( ): big_path = os.path.join(outdir, "upscaled") masked_orig_path = os.path.join(outdir, "modified_originals") - os.makedirs(outdir, exist_ok=True) + generated_imgs_path = os.path.join(outdir, "generated") + os.makedirs(generated_imgs_path, exist_ok=True) base_count = len(os.listdir(outdir)) output_file_extension = output_file_extension.lower() @@ -124,8 +125,7 @@ def imagine_image_files( ): prompt = result.prompt basefilename = f"{base_count:06}_{prompt.seed}_{prompt.sampler_type}{prompt.steps}_PS{prompt.prompt_strength}_{prompt_normalized(prompt.prompt_text)}" - filepath = os.path.join(outdir, "generated", f"{basefilename}.jpg") - os.makedirs(filepath, exist_ok=True) + filepath = os.path.join(generated_imgs_path, f"{basefilename}.jpg") result.save(filepath) logger.info(f" 🖼 saved to: {filepath}") if result.upscaled_img: diff --git a/imaginairy/cmds.py b/imaginairy/cmds.py index 7bfa363..875dca2 100644 --- a/imaginairy/cmds.py +++ b/imaginairy/cmds.py @@ -113,14 +113,13 @@ def configure_logging(level="INFO"): help="What level of logs to show.", ) @click.option( - "--quiet, -q", + "--quiet", "-q", is_flag=True, - type=click.Choice(["DEBUG", "INFO", "WARNING", "ERROR"]), help="Alias of `--log-level ERROR`", ) @click.option( "--show-work", - default=["none"], + default=False, is_flag=True, help="Output a debug images to `steps` folder.", ) @@ -192,6 +191,7 @@ def imagine_cmd( mask_image, mask_prompt, mask_mode, + mask_modify_original, caption, precision, ): @@ -241,10 +241,11 @@ def imagine_cmd( prompts, outdir=outdir, ddim_eta=ddim_eta, - record_step_images="images" in show_work, + record_step_images=show_work, output_file_extension="png", print_caption=caption, precision=precision, + mask_modify_original=mask_modify_original )