Spaces:
Running
Running
yizhangliu
commited on
Commit
•
72b7fc6
1
Parent(s):
235c943
Update app.py
Browse files
app.py
CHANGED
@@ -126,15 +126,14 @@ def model_process_pil(input):
|
|
126 |
# input = request.files
|
127 |
# RGB
|
128 |
# origin_image_bytes = input["image"].read()
|
129 |
-
|
130 |
-
|
131 |
-
print(f'liuyz_2_here_', type(image), image.shape)
|
132 |
|
133 |
-
|
134 |
-
|
135 |
-
print(f'image_pil_ = {type(image_pil)}')
|
136 |
-
print(f'mask_pil_ = {type(mask_pil)}')
|
137 |
-
mask_pil.save(f'./mask_pil.png')
|
138 |
|
139 |
#image, alpha_channel = load_img(image)
|
140 |
# Origin image shape: (512, 512, 3)
|
@@ -189,7 +188,7 @@ def model_process_pil(input):
|
|
189 |
print(f"Resized image shape: {image.shape} / {image[250][250]} / {image.dtype}")
|
190 |
|
191 |
# mask, _ = load_img(mask, gray=True)
|
192 |
-
mask = np.array(mask_pil)
|
193 |
mask = resize_max_size(mask, size_limit=size_limit, interpolation=interpolation)
|
194 |
print(f"mask image shape: {mask.shape} / {type(mask)} / {mask[250][250]} / {mask.dtype}")
|
195 |
|
|
|
126 |
# input = request.files
|
127 |
# RGB
|
128 |
# origin_image_bytes = input["image"].read()
|
129 |
+
image_pil = input['image']
|
130 |
+
mask_pil = input['mask']
|
|
|
131 |
|
132 |
+
image = np.array(image_pil)
|
133 |
+
mask = np.array(mask_pil.convert("L"))
|
134 |
+
# print(f'image_pil_ = {type(image_pil)}')
|
135 |
+
# print(f'mask_pil_ = {type(mask_pil)}')
|
136 |
+
# mask_pil.save(f'./mask_pil.png')
|
137 |
|
138 |
#image, alpha_channel = load_img(image)
|
139 |
# Origin image shape: (512, 512, 3)
|
|
|
188 |
print(f"Resized image shape: {image.shape} / {image[250][250]} / {image.dtype}")
|
189 |
|
190 |
# mask, _ = load_img(mask, gray=True)
|
191 |
+
#mask = np.array(mask_pil)
|
192 |
mask = resize_max_size(mask, size_limit=size_limit, interpolation=interpolation)
|
193 |
print(f"mask image shape: {mask.shape} / {type(mask)} / {mask[250][250]} / {mask.dtype}")
|
194 |
|