Update app.py
Browse files
app.py
CHANGED
@@ -31,12 +31,6 @@ def process_image(image, prompt, threhsold):
|
|
31 |
mask_min = mask.min()
|
32 |
mask_max = mask.max()
|
33 |
mask = (mask - mask_min) / (mask_max - mask_min)
|
34 |
-
|
35 |
-
fig, ax = plt.subplots()
|
36 |
-
ax.imshow(image)
|
37 |
-
ax.imshow(mask, alpha=0.5, cmap="jet")
|
38 |
-
ax.axis("off")
|
39 |
-
plt.tight_layout()
|
40 |
return mask
|
41 |
|
42 |
|
@@ -46,6 +40,12 @@ def get_masks(prompts, img, threhsold):
|
|
46 |
for prompt in prompts:
|
47 |
mask = process_image(img, prompt, threhsold)
|
48 |
mask = mask > threhsold
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
masks.append(mask)
|
50 |
return masks
|
51 |
|
|
|
31 |
mask_min = mask.min()
|
32 |
mask_max = mask.max()
|
33 |
mask = (mask - mask_min) / (mask_max - mask_min)
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
return mask
|
35 |
|
36 |
|
|
|
40 |
for prompt in prompts:
|
41 |
mask = process_image(img, prompt, threhsold)
|
42 |
mask = mask > threhsold
|
43 |
+
|
44 |
+
fig, ax = plt.subplots()
|
45 |
+
ax.imshow(img)
|
46 |
+
ax.imshow(mask, alpha=0.5, cmap="jet")
|
47 |
+
ax.axis("off")
|
48 |
+
plt.tight_layout()
|
49 |
masks.append(mask)
|
50 |
return masks
|
51 |
|