mirror of
https://github.com/azaion/detections.git
synced 2026-04-22 10:46:31 +00:00
[AZ-178] Implement streaming video detection endpoint
- Added `/detect/video` endpoint for true streaming video detection, allowing inference to start as upload bytes arrive. - Introduced `run_detect_video_stream` method in the inference module to handle video processing from a file-like object. - Updated media hashing to include a new function for computing hashes directly from files with minimal I/O. - Enhanced documentation to reflect changes in video processing and API behavior. Made-with: Cursor
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
# Implementation Report — Video Pre-Write Removal
|
||||
|
||||
**Date**: 2026-04-01
|
||||
**Tasks**: 1
|
||||
**Batches**: 1
|
||||
**Total Complexity**: 2 points
|
||||
|
||||
## Summary
|
||||
|
||||
Removed redundant synchronous video pre-writes in the `/detect` endpoint. Videos are now written to disk exactly once by `inference.pyx`'s background writer thread, concurrently with frame detection.
|
||||
|
||||
## Tasks Completed
|
||||
|
||||
| Task | Name | Complexity | Status |
|
||||
|------|------|-----------|--------|
|
||||
| AZ-177 | remove_redundant_video_prewrite | 2 | Done |
|
||||
|
||||
## Changes
|
||||
|
||||
| File | Change |
|
||||
|------|--------|
|
||||
| src/main.py | Auth'd path: wrap file write with `if kind == "image"` so videos skip pre-write |
|
||||
| src/main.py | Non-auth'd path: remove `open().write()` after `mkstemp` — inference handles the write |
|
||||
|
||||
## Test Results
|
||||
|
||||
18/18 tests passed. 4 new tests added:
|
||||
- `test_auth_video_storage_path_opened_wb_once`
|
||||
- `test_non_auth_temp_video_opened_wb_once_and_removed`
|
||||
- `test_auth_image_still_writes_once_before_detect`
|
||||
- `test_video_writer_runs_in_separate_thread_from_executor`
|
||||
Reference in New Issue
Block a user