freealise commited on
Commit
2f0b977
1 Parent(s): c400da7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -1
app.py CHANGED
@@ -169,6 +169,8 @@ def make_video(video_path, outdir='./vis_video_depth', encoder='vits'):
169
  cv2.destroyAllWindows()
170
 
171
  global frame_selected
 
 
172
  return final_vid, final_zip, orig_frames, depth_frames, depth_frames[frame_selected] #output_path
173
 
174
  def depth_edges_mask(depth):
@@ -304,12 +306,18 @@ def loadurl(url):
304
 
305
  def select_frame(v, f, evt: gr.SelectData):
306
  global frame_selected
 
 
 
 
 
 
307
  masks[frame_selected] = v
308
 
309
  if evt.index != frame_selected:
310
  frame_selected = evt.index
311
 
312
- if masks[frame_selected]:
313
  v = masks[frame_selected]
314
  else:
315
  v = f[frame_selected][0]
 
169
  cv2.destroyAllWindows()
170
 
171
  global frame_selected
172
+ global masks
173
+ masks = []
174
  return final_vid, final_zip, orig_frames, depth_frames, depth_frames[frame_selected] #output_path
175
 
176
  def depth_edges_mask(depth):
 
306
 
307
  def select_frame(v, f, evt: gr.SelectData):
308
  global frame_selected
309
+ global masks
310
+ j = 0
311
+ while j < len(f):
312
+ if not masks[j]:
313
+ masks[j] = None
314
+ j = j + 1
315
  masks[frame_selected] = v
316
 
317
  if evt.index != frame_selected:
318
  frame_selected = evt.index
319
 
320
+ if masks[frame_selected] != None:
321
  v = masks[frame_selected]
322
  else:
323
  v = f[frame_selected][0]