Spaces:
Sleeping
Sleeping
Update live_review.py
Browse files- live_review.py +2 -8
live_review.py
CHANGED
|
@@ -3,8 +3,7 @@
|
|
| 3 |
import cv2
|
| 4 |
import numpy as np
|
| 5 |
import tempfile
|
| 6 |
-
from utils import analyze_frame_sequence, overlay_annotations_dynamic, make_decision
|
| 7 |
-
|
| 8 |
|
| 9 |
def analyze_live_video(video):
|
| 10 |
cap = cv2.VideoCapture(video)
|
|
@@ -20,12 +19,7 @@ def analyze_live_video(video):
|
|
| 20 |
analysis = analyze_frame_sequence(recent_frames)
|
| 21 |
decision, reason = make_decision(analysis)
|
| 22 |
|
| 23 |
-
annotated_frames = overlay_annotations(recent_frames, analysis)
|
| 24 |
output_path = tempfile.NamedTemporaryFile(suffix=".mp4", delete=False).name
|
| 25 |
-
|
| 26 |
-
out = cv2.VideoWriter(output_path, cv2.VideoWriter_fourcc(*'mp4v'), 20.0, (w, h))
|
| 27 |
-
for f in annotated_frames:
|
| 28 |
-
out.write(f)
|
| 29 |
-
out.release()
|
| 30 |
|
| 31 |
return decision, reason, output_path
|
|
|
|
| 3 |
import cv2
|
| 4 |
import numpy as np
|
| 5 |
import tempfile
|
| 6 |
+
from utils import analyze_frame_sequence, overlay_annotations_dynamic, make_decision, render_annotated_clip
|
|
|
|
| 7 |
|
| 8 |
def analyze_live_video(video):
|
| 9 |
cap = cv2.VideoCapture(video)
|
|
|
|
| 19 |
analysis = analyze_frame_sequence(recent_frames)
|
| 20 |
decision, reason = make_decision(analysis)
|
| 21 |
|
|
|
|
| 22 |
output_path = tempfile.NamedTemporaryFile(suffix=".mp4", delete=False).name
|
| 23 |
+
render_annotated_clip(recent_frames, analysis, decision, reason, output_path)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
|
| 25 |
return decision, reason, output_path
|