John Ho commited on
Commit
ff0753c
·
1 Parent(s): 538c7ad

only create annotated frames in annotation_mode

Browse files
Files changed (1) hide show
  1. app.py +7 -5
app.py CHANGED
@@ -208,12 +208,14 @@ def video_inference(input_video, prompt: str, annotation_mode: bool = False):
208
  "mask_b64": b64_mask_encode(mask_bin).decode("ascii"),
209
  }
210
  detections.append(det)
211
- final_frame = apply_mask_overlay(
212
- original_pil, detected_masks, object_ids=object_ids
 
 
 
 
213
  )
214
- else:
215
- final_frame = original_pil
216
- annotated_frames.append(final_frame)
217
 
218
  return (
219
  frames_to_vid(
 
208
  "mask_b64": b64_mask_encode(mask_bin).decode("ascii"),
209
  }
210
  detections.append(det)
211
+
212
+ if annotation_mode:
213
+ final_frame = (
214
+ apply_mask_overlay(original_pil, detected_masks, object_ids=object_ids)
215
+ if "masks" in post_processed
216
+ else original_pil
217
  )
218
+ annotated_frames.append(final_frame)
 
 
219
 
220
  return (
221
  frames_to_vid(