freealise commited on
Commit
031aec4
1 Parent(s): 22931c8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -349,8 +349,8 @@ def switch_rows(v):
349
 
350
  def draw_mask(f, n, c, v, d, evt: gr.EventData):
351
  print(v)
352
- vv = json.loads(v)
353
- pts = np.array(vv, np.int32)
354
  pts = pts.reshape((-1,1,2))
355
 
356
  if d["background"].shape[0] == 2048: #height
@@ -393,8 +393,8 @@ def draw_mask(f, n, c, v, d, evt: gr.EventData):
393
  mask = cv2.inRange(abs_grad, 1, 255)
394
  d["layers"][0][mask>0] = (0,0,0,255)
395
 
396
- x = pts[len(pts)-1][0]
397
- y = pts[len(pts)-1][1]
398
 
399
  d["layers"][0] = cv2.floodFill(d["layers"][0], d["layers"][0], (x, y), (0,0,0,255), 0, 0, (
400
  4 | cv2.FLOODFILL_FIXED_RANGE #| cv2.FLOODFILL_MASK_ONLY | 255 << 8
 
349
 
350
  def draw_mask(f, n, c, v, d, evt: gr.EventData):
351
  print(v)
352
+ points = json.loads(v)
353
+ pts = np.array(points, np.int32)
354
  pts = pts.reshape((-1,1,2))
355
 
356
  if d["background"].shape[0] == 2048: #height
 
393
  mask = cv2.inRange(abs_grad, 1, 255)
394
  d["layers"][0][mask>0] = (0,0,0,255)
395
 
396
+ x = points[len(points)-1][0]
397
+ y = points[len(points)-1][1]
398
 
399
  d["layers"][0] = cv2.floodFill(d["layers"][0], d["layers"][0], (x, y), (0,0,0,255), 0, 0, (
400
  4 | cv2.FLOODFILL_FIXED_RANGE #| cv2.FLOODFILL_MASK_ONLY | 255 << 8