Spaces:
Starting
Starting
Update app.py
Browse files
app.py
CHANGED
@@ -20,7 +20,7 @@ from depth_anything.dpt import DepthAnything
|
|
20 |
from depth_anything.util.transform import Resize, NormalizeImage, PrepareForNet
|
21 |
from moviepy.editor import *
|
22 |
|
23 |
-
edge =
|
24 |
gradient = None
|
25 |
params = { "fnum":0, "l":16, "c":3, "k":7 }
|
26 |
frame_selected = 0
|
@@ -342,7 +342,7 @@ def select_frame(v, evt: gr.SelectData):
|
|
342 |
if evt.index != frame_selected:
|
343 |
masks[frame_selected] = v
|
344 |
frame_selected = evt.index
|
345 |
-
edge =
|
346 |
|
347 |
return masks[frame_selected], frame_selected
|
348 |
|
@@ -382,8 +382,8 @@ def draw_mask(l, c, k, v, d, evt: gr.EventData):
|
|
382 |
delta = 0
|
383 |
ddepth = cv2.CV_16S
|
384 |
|
385 |
-
if edge ==
|
386 |
-
if edge !=
|
387 |
d["background"] = cv2.imread(masks[frame_selected]).astype(np.uint8)
|
388 |
|
389 |
bg = cv2.cvtColor(d["background"], cv2.COLOR_RGBA2GRAY)
|
|
|
20 |
from depth_anything.util.transform import Resize, NormalizeImage, PrepareForNet
|
21 |
from moviepy.editor import *
|
22 |
|
23 |
+
edge = []
|
24 |
gradient = None
|
25 |
params = { "fnum":0, "l":16, "c":3, "k":7 }
|
26 |
frame_selected = 0
|
|
|
342 |
if evt.index != frame_selected:
|
343 |
masks[frame_selected] = v
|
344 |
frame_selected = evt.index
|
345 |
+
edge = []
|
346 |
|
347 |
return masks[frame_selected], frame_selected
|
348 |
|
|
|
382 |
delta = 0
|
383 |
ddepth = cv2.CV_16S
|
384 |
|
385 |
+
if edge == [] or params["fnum"] != frame_selected or params["l"] != l or params["c"] != c or params["k"] != k:
|
386 |
+
if edge != []:
|
387 |
d["background"] = cv2.imread(masks[frame_selected]).astype(np.uint8)
|
388 |
|
389 |
bg = cv2.cvtColor(d["background"], cv2.COLOR_RGBA2GRAY)
|