Spaces:
Running
on
Zero
Running
on
Zero
Add error handling
Browse files
app.py
CHANGED
@@ -536,11 +536,14 @@ def delete_last_step(tracking_points, first_frame_path, drag_mode):
|
|
536 |
color = (255, 0, 0, 255)
|
537 |
elif drag_mode == "camera":
|
538 |
color = (0, 0, 255, 255)
|
539 |
-
tracking_points[-1]
|
|
|
540 |
transparent_background = Image.open(first_frame_path).convert("RGBA")
|
541 |
w, h = transparent_background.size
|
542 |
transparent_layer = np.zeros((h, w, 4))
|
543 |
for track in tracking_points:
|
|
|
|
|
544 |
if len(track) > 1:
|
545 |
for i in range(len(track) - 1):
|
546 |
start_point = track[i]
|
|
|
536 |
color = (255, 0, 0, 255)
|
537 |
elif drag_mode == "camera":
|
538 |
color = (0, 0, 255, 255)
|
539 |
+
if tracking_points and tracking_points[-1]:
|
540 |
+
tracking_points[-1].pop()
|
541 |
transparent_background = Image.open(first_frame_path).convert("RGBA")
|
542 |
w, h = transparent_background.size
|
543 |
transparent_layer = np.zeros((h, w, 4))
|
544 |
for track in tracking_points:
|
545 |
+
if not track:
|
546 |
+
continue
|
547 |
if len(track) > 1:
|
548 |
for i in range(len(track) - 1):
|
549 |
start_point = track[i]
|