fix inpainting of nai-diffusion-4-full
This commit is contained in:
@@ -231,7 +231,7 @@ class GenerateNAID:
|
||||
action = "infill"
|
||||
image, mask, add_original_image = option["infill"]
|
||||
params["image"] = image_to_base64(resize_image(image, (width, height)))
|
||||
params["mask"] = naimask_to_base64(resize_to_naimask(mask, (width, height)))
|
||||
params["mask"] = naimask_to_base64(resize_to_naimask(mask, (width, height), "4" in model))
|
||||
params["add_original_image"] = add_original_image
|
||||
|
||||
if "vibe" in option:
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
[project]
|
||||
name = "comfyui_naidgenerator"
|
||||
description = "This extension helps generate images through NAI."
|
||||
version = "1.0.6"
|
||||
version = "1.0.7"
|
||||
license = { file = "LICENSE" }
|
||||
dependencies = ["python-dotenv", "argon2-cffi"]
|
||||
|
||||
|
||||
@@ -121,12 +121,14 @@ def resize_image(image, size_to):
|
||||
s = s.movedim(1,-1)
|
||||
return s
|
||||
|
||||
def resize_to_naimask(mask, image_size=None):
|
||||
def resize_to_naimask(mask, image_size=None, is_v4=False):
|
||||
samples = mask.movedim(-1,1)
|
||||
w, h = (samples.shape[3], samples.shape[2]) if not image_size else image_size
|
||||
width = int(np.ceil(w / 64) * 8)
|
||||
height = int(np.ceil(h / 64) * 8)
|
||||
s = comfy.utils.common_upscale(samples, width, height, "nearest-exact", "disabled")
|
||||
if is_v4:
|
||||
s = comfy.utils.common_upscale(s, width*8, height*8, "nearest-exact", "disabled")
|
||||
s = s.movedim(1,-1)
|
||||
return s
|
||||
|
||||
|
||||
Reference in New Issue
Block a user