Commit 3665551b authored by d8ahazard's avatar d8ahazard
Browse files
parents 8f1d412e 2162be51
Loading
Loading
Loading
Loading
+0 −0

Empty file added.

+1 −1
Original line number Diff line number Diff line
@@ -67,7 +67,7 @@ class UpscalerBSRGAN(modules.upscaler.Upscaler):
        else:
            filename = path
        if not os.path.exists(filename) or filename is None:
            print("Unable to load %s from %s" % (self.model_path, filename))
            print(f"BSRGAN: Unable to load model from {filename}", file=sys.stderr)
            return None
        print("Loading %s from %s" % (self.model_path, filename))
        model = RRDBNet(in_nc=3, out_nc=3, nf=64, nb=23, gc=32, sf=4)  # define network
+10 −8
Original line number Diff line number Diff line
@@ -213,17 +213,19 @@ def resize_image(resize_mode, im, width, height):
        if opts.upscaler_for_img2img is None or opts.upscaler_for_img2img == "None" or im.mode == 'L':
            return im.resize((w, h), resample=LANCZOS)

        scale = max(w / im.width, h / im.height)

        if scale > 1.0:
            upscalers = [x for x in shared.sd_upscalers if x.name == opts.upscaler_for_img2img]
            assert len(upscalers) > 0, f"could not find upscaler named {opts.upscaler_for_img2img}"

            upscaler = upscalers[0]
        scale = max(w / im.width, h / im.height)
        upscaled = upscaler.scaler.upscale(im, scale, upscaler.data_path)
            im = upscaler.scaler.upscale(im, scale, upscaler.data_path)

        if upscaled.width != w or upscaled.height != h:
            upscaled = im.resize((w, h), resample=LANCZOS)
        if im.width != w or im.height != h:
            im = im.resize((w, h), resample=LANCZOS)

        return upscaled
        return im

    if resize_mode == 0:
        res = resize(im, width, height)
+6 −1
Original line number Diff line number Diff line
@@ -232,7 +232,12 @@ class StableDiffusionModelHijack:

        for fn in os.listdir(dirname):
            try:
                process_file(os.path.join(dirname, fn), fn)
                fullfn = os.path.join(dirname, fn)

                if os.stat(fullfn).st_size == 0:
                    continue

                process_file(fullfn, fn)
            except Exception:
                print(f"Error loading emedding {fn}:", file=sys.stderr)
                print(traceback.format_exc(), file=sys.stderr)
+1 −1
Original line number Diff line number Diff line
@@ -599,7 +599,7 @@ def create_ui(txt2img, img2img, run_extras, run_pnginfo, run_modelmerger):
                            mask_mode = gr.Radio(label="Mask mode", show_label=False, choices=["Draw mask", "Upload mask"], type="index", value="Draw mask", elem_id="mask_mode")
                            inpainting_mask_invert = gr.Radio(label='Masking mode', show_label=False, choices=['Inpaint masked', 'Inpaint not masked'], value='Inpaint masked', type="index")

                        inpainting_fill = gr.Radio(label='Masked content', choices=['fill', 'original', 'latent noise', 'latent nothing'], value='fill', type="index")
                        inpainting_fill = gr.Radio(label='Masked content', choices=['fill', 'original', 'latent noise', 'latent nothing'], value='original', type="index")

                        with gr.Row():
                            inpaint_full_res = gr.Checkbox(label='Inpaint at full resolution', value=False)