freealise commited on
Commit
f0bb6a1
1 Parent(s): 28e2201

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -0
app.py CHANGED
@@ -348,6 +348,9 @@ def switch_rows(v):
348
  return frames
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)
@@ -363,6 +366,8 @@ def draw_mask(f, n, c, v, d, evt: gr.EventData):
363
 
364
  if len(d["layers"]) == 1:
365
  d["layers"].append(np.zeros_like(d["layers"][0]))
 
 
366
 
367
  #indices = np.arange(0,256) # List of all colors
368
  #divider = np.linspace(0,255,n+1)[1] # we get a divider
 
348
  return frames
349
 
350
  def draw_mask(f, n, c, v, d, evt: gr.EventData):
351
+ global frame_selected
352
+ global masks
353
+
354
  print(v)
355
  points = json.loads(v)
356
  pts = np.array(points, np.int32)
 
366
 
367
  if len(d["layers"]) == 1:
368
  d["layers"].append(np.zeros_like(d["layers"][0]))
369
+ else:
370
+ d["background"] = masks[frame_selected]
371
 
372
  #indices = np.arange(0,256) # List of all colors
373
  #divider = np.linspace(0,255,n+1)[1] # we get a divider