fix: various bugfixes

This commit is contained in:
Bryce 2022-09-24 11:21:53 -07:00 committed by Bryce Drennan
parent 2eec756fab
commit b69072d382
2 changed files with 8 additions and 7 deletions

View File

@ -95,7 +95,8 @@ def imagine_image_files(
): ):
big_path = os.path.join(outdir, "upscaled") big_path = os.path.join(outdir, "upscaled")
masked_orig_path = os.path.join(outdir, "modified_originals") 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)) base_count = len(os.listdir(outdir))
output_file_extension = output_file_extension.lower() output_file_extension = output_file_extension.lower()
@ -124,8 +125,7 @@ def imagine_image_files(
): ):
prompt = result.prompt prompt = result.prompt
basefilename = f"{base_count:06}_{prompt.seed}_{prompt.sampler_type}{prompt.steps}_PS{prompt.prompt_strength}_{prompt_normalized(prompt.prompt_text)}" 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") filepath = os.path.join(generated_imgs_path, f"{basefilename}.jpg")
os.makedirs(filepath, exist_ok=True)
result.save(filepath) result.save(filepath)
logger.info(f" 🖼 saved to: {filepath}") logger.info(f" 🖼 saved to: {filepath}")
if result.upscaled_img: if result.upscaled_img:

View File

@ -113,14 +113,13 @@ def configure_logging(level="INFO"):
help="What level of logs to show.", help="What level of logs to show.",
) )
@click.option( @click.option(
"--quiet, -q", "--quiet", "-q",
is_flag=True, is_flag=True,
type=click.Choice(["DEBUG", "INFO", "WARNING", "ERROR"]),
help="Alias of `--log-level ERROR`", help="Alias of `--log-level ERROR`",
) )
@click.option( @click.option(
"--show-work", "--show-work",
default=["none"], default=False,
is_flag=True, is_flag=True,
help="Output a debug images to `steps` folder.", help="Output a debug images to `steps` folder.",
) )
@ -192,6 +191,7 @@ def imagine_cmd(
mask_image, mask_image,
mask_prompt, mask_prompt,
mask_mode, mask_mode,
mask_modify_original,
caption, caption,
precision, precision,
): ):
@ -241,10 +241,11 @@ def imagine_cmd(
prompts, prompts,
outdir=outdir, outdir=outdir,
ddim_eta=ddim_eta, ddim_eta=ddim_eta,
record_step_images="images" in show_work, record_step_images=show_work,
output_file_extension="png", output_file_extension="png",
print_caption=caption, print_caption=caption,
precision=precision, precision=precision,
mask_modify_original=mask_modify_original
) )