Spaces:
Runtime error
Runtime error
Upload app.py
Browse files
app.py
CHANGED
@@ -78,9 +78,8 @@ def segment_with_boxs(
|
|
78 |
use_retina=True,
|
79 |
mask_random_color=True,
|
80 |
):
|
81 |
-
|
82 |
if len(global_points) < 2:
|
83 |
-
return seg_image
|
84 |
print("Original Image : ", image.size)
|
85 |
|
86 |
input_size = int(input_size)
|
@@ -104,7 +103,7 @@ def segment_with_boxs(
|
|
104 |
|
105 |
if scaled_points.size == 0 and scaled_point_label.size == 0:
|
106 |
print("No points selected")
|
107 |
-
return image
|
108 |
|
109 |
nd_image = np.array(image)
|
110 |
img_tensor = ToTensor()(nd_image)
|
@@ -171,7 +170,6 @@ def segment_with_points(
|
|
171 |
use_retina=True,
|
172 |
mask_random_color=True,
|
173 |
):
|
174 |
-
print("Starting getting points")
|
175 |
print("Original Image : ", image.size)
|
176 |
|
177 |
input_size = int(input_size)
|
@@ -185,9 +183,9 @@ def segment_with_points(
|
|
185 |
print("Scale : ", scale)
|
186 |
|
187 |
if global_points is None:
|
188 |
-
return image
|
189 |
if len(global_points) < 1:
|
190 |
-
return image
|
191 |
scaled_points = np.array(
|
192 |
[[int(x * scale) for x in point] for point in global_points]
|
193 |
)
|
@@ -198,7 +196,7 @@ def segment_with_points(
|
|
198 |
|
199 |
if scaled_points.size == 0 and scaled_point_label.size == 0:
|
200 |
print("No points selected")
|
201 |
-
return image
|
202 |
|
203 |
nd_image = np.array(image)
|
204 |
img_tensor = ToTensor()(nd_image)
|
@@ -273,7 +271,7 @@ def get_points_with_draw_(image, cond_image, global_points, global_point_label,
|
|
273 |
if len(global_points) == 0:
|
274 |
image = copy.deepcopy(cond_image)
|
275 |
if len(global_points) > 2:
|
276 |
-
return image
|
277 |
x, y = evt.index[0], evt.index[1]
|
278 |
label = "Add Mask"
|
279 |
point_radius, point_color = 15, (255, 255, 0) if label == "Add Mask" else (
|
|
|
78 |
use_retina=True,
|
79 |
mask_random_color=True,
|
80 |
):
|
|
|
81 |
if len(global_points) < 2:
|
82 |
+
return seg_image, global_points, global_point_label
|
83 |
print("Original Image : ", image.size)
|
84 |
|
85 |
input_size = int(input_size)
|
|
|
103 |
|
104 |
if scaled_points.size == 0 and scaled_point_label.size == 0:
|
105 |
print("No points selected")
|
106 |
+
return image, global_points, global_point_label
|
107 |
|
108 |
nd_image = np.array(image)
|
109 |
img_tensor = ToTensor()(nd_image)
|
|
|
170 |
use_retina=True,
|
171 |
mask_random_color=True,
|
172 |
):
|
|
|
173 |
print("Original Image : ", image.size)
|
174 |
|
175 |
input_size = int(input_size)
|
|
|
183 |
print("Scale : ", scale)
|
184 |
|
185 |
if global_points is None:
|
186 |
+
return image, global_points, global_point_label
|
187 |
if len(global_points) < 1:
|
188 |
+
return image, global_points, global_point_label
|
189 |
scaled_points = np.array(
|
190 |
[[int(x * scale) for x in point] for point in global_points]
|
191 |
)
|
|
|
196 |
|
197 |
if scaled_points.size == 0 and scaled_point_label.size == 0:
|
198 |
print("No points selected")
|
199 |
+
return image, global_points, global_point_label
|
200 |
|
201 |
nd_image = np.array(image)
|
202 |
img_tensor = ToTensor()(nd_image)
|
|
|
271 |
if len(global_points) == 0:
|
272 |
image = copy.deepcopy(cond_image)
|
273 |
if len(global_points) > 2:
|
274 |
+
return image, global_points, global_point_label
|
275 |
x, y = evt.index[0], evt.index[1]
|
276 |
label = "Add Mask"
|
277 |
point_radius, point_color = 15, (255, 255, 0) if label == "Add Mask" else (
|