Mirko Trasciatti commited on
Commit
a244a38
·
1 Parent(s): f72bbd5

Respect annotation toggle in overlays

Browse files
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -893,7 +893,9 @@ def compose_frame(state: AppState, frame_idx: int, remove_bg: bool = False) -> I
893
  frame_idx = int(np.clip(frame_idx, 0, len(state.video_frames) - 1))
894
  frame = state.video_frames[frame_idx]
895
  masks = state.masks_by_frame.get(frame_idx, {})
896
- out_img = frame
 
 
897
 
898
  current_union_mask: np.ndarray | None = None
899
  focus_mask: np.ndarray | None = None
@@ -974,7 +976,7 @@ def compose_frame(state: AppState, frame_idx: int, remove_bg: bool = False) -> I
974
  draw.line([(x, y - cross_half), (x, y + cross_half)], fill=color, width=2)
975
  # Draw boxes for conditioning frames
976
  box_map = state.boxes_by_frame_obj.get(frame_idx)
977
- if box_map:
978
  draw = ImageDraw.Draw(out_img)
979
  for obj_id, boxes in box_map.items():
980
  color = state.color_by_obj.get(obj_id, (255, 255, 255))
 
893
  frame_idx = int(np.clip(frame_idx, 0, len(state.video_frames) - 1))
894
  frame = state.video_frames[frame_idx]
895
  masks = state.masks_by_frame.get(frame_idx, {})
896
+ out_img: Image.Image | None = state.composited_frames.get(frame_idx)
897
+ if out_img is None:
898
+ out_img = frame
899
 
900
  current_union_mask: np.ndarray | None = None
901
  focus_mask: np.ndarray | None = None
 
976
  draw.line([(x, y - cross_half), (x, y + cross_half)], fill=color, width=2)
977
  # Draw boxes for conditioning frames
978
  box_map = state.boxes_by_frame_obj.get(frame_idx)
979
+ if state.show_click_marks and box_map:
980
  draw = ImageDraw.Draw(out_img)
981
  for obj_id, boxes in box_map.items():
982
  color = state.color_by_obj.get(obj_id, (255, 255, 255))