Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -142,29 +142,11 @@ def inpaint(image, width, height, overlap_percentage, num_inference_steps, resiz
|
|
142 |
num_inference_steps=num_inference_steps,
|
143 |
guidance_scale=guidance_scale,
|
144 |
).images[0]
|
145 |
-
|
146 |
result = result.convert("RGBA")
|
147 |
-
|
148 |
-
print("Type of mask: {}".format(type(mask)))
|
149 |
-
print("Type of cnet: {}".format(type(cnet_image)))
|
150 |
-
# mask_blur = mask.filter(ImageFilter.GaussianBlur(10))
|
151 |
-
# cnet_image = Image.composite(result, cnet_image, mask)
|
152 |
-
size = 10; # how many pixel extension do you want to dilate
|
153 |
-
number = 1; # numbering purpose
|
154 |
-
name = ""
|
155 |
-
#trimap_mask = trimap(np.array(mask), name, size, number, erosion=False)
|
156 |
-
|
157 |
-
# estimate alpha from image and trimap
|
158 |
-
#alpha = estimate_alpha_cf(np.array(cnet_image), trimap_mask)
|
159 |
-
|
160 |
-
# make gray background
|
161 |
-
#background = result
|
162 |
-
|
163 |
-
# estimate foreground from image and alpha
|
164 |
-
#foreground = estimate_foreground_ml(np.array(cnet_image), alpha)
|
165 |
|
166 |
-
|
167 |
-
#new_image = blend(foreground, np.array(background), alpha)
|
168 |
cnet_pure = cnet_image
|
169 |
cnet_image.paste(result, (0, 0), mask)
|
170 |
|
|
|
142 |
num_inference_steps=num_inference_steps,
|
143 |
guidance_scale=guidance_scale,
|
144 |
).images[0]
|
145 |
+
|
146 |
result = result.convert("RGBA")
|
147 |
+
cnet_image.paste(result, (0, 0), mask)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
148 |
|
149 |
+
mask_blur = mask.filter(ImageFilter.GaussianBlur(50))
|
|
|
150 |
cnet_pure = cnet_image
|
151 |
cnet_image.paste(result, (0, 0), mask)
|
152 |
|