fix mask generation (#600)

This commit is contained in:
Thomas Mello 2022-09-04 03:28:15 +03:00 committed by GitHub
parent d8a323ebc6
commit 435d152c24
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 5 deletions

View File

@ -348,7 +348,7 @@ def draw_gradio_ui(opt, img2img=lambda x: x, txt2img=lambda x: x,imgproc=lambda
)
img2img_func = img2img
img2img_inputs = [img2img_prompt, img2img_image_editor_mode, img2img_image_editor, img2img_mask,
img2img_inputs = [img2img_prompt, img2img_image_editor_mode, img2img_image_editor, img2img_image_mask, img2img_mask,
img2img_mask_blur_strength, img2img_steps, img2img_sampling, img2img_toggles,
img2img_realesrgan_model_name, img2img_batch_count, img2img_cfg,
img2img_denoising, img2img_seed, img2img_height, img2img_width, img2img_resize,

View File

@ -1222,7 +1222,7 @@ class Flagging(gr.FlaggingCallback):
print("Logged:", filenames[0])
def img2img(prompt: str, image_editor_mode: str, init_info: Dict[str,Image.Image], mask_mode: str, mask_blur_strength: int, ddim_steps: int, sampler_name: str,
def img2img(prompt: str, image_editor_mode: str, init_info: any, init_info_mask: any, mask_mode: str, mask_blur_strength: int, ddim_steps: int, sampler_name: str,
toggles: List[int], realesrgan_model_name: str, n_iter: int, cfg_scale: float, denoising_strength: float,
seed: int, height: int, width: int, resize_mode: int, fp = None, job_info: JobInfo = None):
outpath = opt.outdir_img2img or opt.outdir or "outputs/img2img-samples"
@ -1270,11 +1270,10 @@ def img2img(prompt: str, image_editor_mode: str, init_info: Dict[str,Image.Image
raise Exception("Unknown sampler: " + sampler_name)
if image_editor_mode == 'Mask':
init_img = init_info["image"]
init_img = init_info_mask["image"]
init_img = init_img.convert("RGB")
init_img = resize_image(resize_mode, init_img, width, height)
init_mask = init_info["mask"]
print(init_mask)
init_mask = init_info_mask["mask"]
init_mask = resize_image(resize_mode, init_mask, width, height)
keep_mask = mask_mode == 0
init_mask = init_mask.convert("RGB")