Fix inference issues
Browse files
app.py
CHANGED
|
@@ -176,17 +176,16 @@ def inference(image):
|
|
| 176 |
# Process the mask without cropping
|
| 177 |
processed_mask = smooth_and_denoise(mask)
|
| 178 |
|
| 179 |
-
# Convert processed mask to PIL image
|
| 180 |
pil_mask = Image.fromarray(processed_mask).convert('L')
|
| 181 |
im_rgb = Image.open(image).convert("RGB")
|
| 182 |
-
pil_mask_resized = pil_mask.resize(im_rgb.size, Image.ANTIALIAS)
|
| 183 |
|
| 184 |
im_dark = Image.new('RGB', im_rgb.size, (0, 0, 0))
|
| 185 |
|
| 186 |
-
# Apply
|
| 187 |
im_rgba = im_rgb.copy()
|
| 188 |
-
im_rgba.putalpha(
|
| 189 |
-
im_dark.putalpha(
|
| 190 |
|
| 191 |
return [im_rgba, pil_mask, im_dark]
|
| 192 |
|
|
|
|
| 176 |
# Process the mask without cropping
|
| 177 |
processed_mask = smooth_and_denoise(mask)
|
| 178 |
|
| 179 |
+
# Convert processed mask to PIL image
|
| 180 |
pil_mask = Image.fromarray(processed_mask).convert('L')
|
| 181 |
im_rgb = Image.open(image).convert("RGB")
|
|
|
|
| 182 |
|
| 183 |
im_dark = Image.new('RGB', im_rgb.size, (0, 0, 0))
|
| 184 |
|
| 185 |
+
# Apply mask to images
|
| 186 |
im_rgba = im_rgb.copy()
|
| 187 |
+
im_rgba.putalpha(pil_mask)
|
| 188 |
+
im_dark.putalpha(pil_mask)
|
| 189 |
|
| 190 |
return [im_rgba, pil_mask, im_dark]
|
| 191 |
|