Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -27,7 +27,6 @@ processor = SamProcessor.from_pretrained("facebook/sam-vit-huge")
|
|
27 |
global_points = []
|
28 |
global_point_label = []
|
29 |
previous_box_points = 0
|
30 |
-
draw = None
|
31 |
|
32 |
# Description
|
33 |
title = "<center><strong><font size='8'> ๐ Segment food with clicks ๐</font></strong></center>"
|
@@ -53,8 +52,6 @@ def read_image(url):
|
|
53 |
|
54 |
global_points = []
|
55 |
global_point_label = []
|
56 |
-
|
57 |
-
draw = ImageDraw.Draw(img)
|
58 |
|
59 |
return img
|
60 |
|
@@ -185,13 +182,14 @@ def get_points_with_draw(image, label, evt: gr.SelectData):
|
|
185 |
global global_points
|
186 |
global global_point_label
|
187 |
global previous_box_points
|
188 |
-
global draw
|
189 |
|
190 |
x, y = evt.index[0], evt.index[1]
|
191 |
point_radius = 15
|
192 |
point_color = (255, 255, 0) if label == 'Add Mask' else (255, 0, 255)
|
193 |
global_points.append([x, y])
|
194 |
global_point_label.append(1 if label == 'Add Mask' else 0 if label == 'Remove Area' else 9)
|
|
|
|
|
195 |
|
196 |
print(x, y, label)
|
197 |
print(previous_box_points)
|
|
|
27 |
global_points = []
|
28 |
global_point_label = []
|
29 |
previous_box_points = 0
|
|
|
30 |
|
31 |
# Description
|
32 |
title = "<center><strong><font size='8'> ๐ Segment food with clicks ๐</font></strong></center>"
|
|
|
52 |
|
53 |
global_points = []
|
54 |
global_point_label = []
|
|
|
|
|
55 |
|
56 |
return img
|
57 |
|
|
|
182 |
global global_points
|
183 |
global global_point_label
|
184 |
global previous_box_points
|
|
|
185 |
|
186 |
x, y = evt.index[0], evt.index[1]
|
187 |
point_radius = 15
|
188 |
point_color = (255, 255, 0) if label == 'Add Mask' else (255, 0, 255)
|
189 |
global_points.append([x, y])
|
190 |
global_point_label.append(1 if label == 'Add Mask' else 0 if label == 'Remove Area' else 9)
|
191 |
+
|
192 |
+
draw = ImageDraw.Draw(image)
|
193 |
|
194 |
print(x, y, label)
|
195 |
print(previous_box_points)
|