chongzhou commited on
Commit
3344f75
·
1 Parent(s): 4975443

solve the concurrent visiting problem in a very inefficient way

Browse files
Files changed (1) hide show
  1. app.py +9 -2
app.py CHANGED
@@ -167,8 +167,8 @@ def on_image_upload(image, input_size=1024):
167
  global_image = copy.deepcopy(image)
168
  global_image_with_prompt = copy.deepcopy(image)
169
  print("Image changed")
170
- nd_image = np.array(global_image)
171
- predictor.set_image(nd_image)
172
 
173
  return image
174
 
@@ -196,6 +196,7 @@ def segment_with_points(
196
  ):
197
  global global_points
198
  global global_point_label
 
199
  global global_image_with_prompt
200
 
201
  x, y = evt.index[0], evt.index[1]
@@ -213,6 +214,9 @@ def segment_with_points(
213
  )
214
  image = global_image_with_prompt
215
 
 
 
 
216
  if ENABLE_ONNX:
217
  global_points_np = np.array(global_points)[None]
218
  global_point_label_np = np.array(global_point_label)[None]
@@ -263,6 +267,7 @@ def segment_with_box(
263
  ):
264
  global global_box
265
  global global_image
 
266
  global global_image_with_prompt
267
 
268
  x, y = evt.index[0], evt.index[1]
@@ -296,6 +301,8 @@ def segment_with_box(
296
  )
297
 
298
  global_box_np = np.array(global_box)
 
 
299
  if ENABLE_ONNX:
300
  point_coords = global_box_np.reshape(2, 2)[None]
301
  point_labels = np.array([2, 3])[None]
 
167
  global_image = copy.deepcopy(image)
168
  global_image_with_prompt = copy.deepcopy(image)
169
  print("Image changed")
170
+ # nd_image = np.array(global_image)
171
+ # predictor.set_image(nd_image)
172
 
173
  return image
174
 
 
196
  ):
197
  global global_points
198
  global global_point_label
199
+ global global_image
200
  global global_image_with_prompt
201
 
202
  x, y = evt.index[0], evt.index[1]
 
214
  )
215
  image = global_image_with_prompt
216
 
217
+ nd_image = np.array(global_image)
218
+ predictor.set_image(nd_image)
219
+
220
  if ENABLE_ONNX:
221
  global_points_np = np.array(global_points)[None]
222
  global_point_label_np = np.array(global_point_label)[None]
 
267
  ):
268
  global global_box
269
  global global_image
270
+ global global_image
271
  global global_image_with_prompt
272
 
273
  x, y = evt.index[0], evt.index[1]
 
301
  )
302
 
303
  global_box_np = np.array(global_box)
304
+ nd_image = np.array(global_image)
305
+ predictor.set_image(nd_image)
306
  if ENABLE_ONNX:
307
  point_coords = global_box_np.reshape(2, 2)[None]
308
  point_labels = np.array([2, 3])[None]