From 852baf422ad86e406e0fa999c2f340bfd6a272d2 Mon Sep 17 00:00:00 2001 From: AUTOMATIC <16777216c@gmail.com> Date: Wed, 24 Aug 2022 13:42:21 +0300 Subject: [PATCH] gfpgan dir for the guide's directory names fix a bug in image resizing --- README.md | 7 +++++++ webui.py | 4 ++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 2c6a0a273..be323024f 100644 --- a/README.md +++ b/README.md @@ -96,6 +96,13 @@ same time for a small speed boost). Click the Flag button under the output section, and generated images will be saved to `log/images` directory, and generation parameters will be appended to a csv file `log/log.csv` in the `/sd` directory. +> but every image is saved, why would I need this? + +If you're like me, you experiment a lot with prompts and settings, and only few images are worth saving. You can +just save them using right click in browser, but then you won't be able to reproduce them later because you will not +know what exact prompt created the image. If you use the flag button, generation paramerters will be written to csv file, +and you can easily find parameters for an image by searching for its filename. + ### Copy-paste generation parameters A text output provides generation parameters in an easy to copy-paste form for easy sharing. diff --git a/webui.py b/webui.py index 1f782c0b2..9c589bba7 100644 --- a/webui.py +++ b/webui.py @@ -45,7 +45,7 @@ parser.add_argument("--n_rows", type=int, default=-1, help="rows in the grid; us parser.add_argument("--config", type=str, default="configs/stable-diffusion/v1-inference.yaml", help="path to config which constructs model",) parser.add_argument("--ckpt", type=str, default="models/ldm/stable-diffusion-v1/model.ckpt", help="path to checkpoint of model",) parser.add_argument("--precision", type=str, help="evaluate at this precision", choices=["full", "autocast"], default="autocast") -parser.add_argument("--gfpgan-dir", type=str, help="GFPGAN directory", default='./GFPGAN') +parser.add_argument("--gfpgan-dir", type=str, help="GFPGAN directory", default=('./src/gfpgan' if os.path.exists('./src/gfpgan') else './GFPGAN')) # i disagree with where you're putting it but since all guidefags are doing it this way, there you go parser.add_argument("--no-verify-input", action='store_true', help="do not verify input to check if it's too long") parser.add_argument("--no-half", action='store_true', help="do not switch the model to 16-bit floats") parser.add_argument("--no-progressbar-hiding", action='store_true', help="do not hide progressbar in gradio UI (we hide it because it slows down ML if you have hardware accleration in browser)") @@ -269,7 +269,7 @@ def resize_image(resize_mode, im, width, height): fill_height = height // 2 - src_h // 2 res.paste(resized.resize((width, fill_height), box=(0, 0, width, 0)), box=(0, 0)) res.paste(resized.resize((width, fill_height), box=(0, resized.height, width, resized.height)), box=(0, fill_height + src_h)) - else: + elif ratio > src_ratio: fill_width = width // 2 - src_w // 2 res.paste(resized.resize((fill_width, height), box=(0, 0, 0, height)), box=(0, 0)) res.paste(resized.resize((fill_width, height), box=(resized.width, 0, resized.width, height)), box=(fill_width + src_w, 0))