mirror of
https://github.com/azaion/detections.git
synced 2026-04-26 00:46:31 +00:00
[AZ-180] Enhance setup and improve inference logging
- Added a new Cython extension for the engine factory to the setup configuration. - Updated the inference module to include additional logging for video batch processing and annotation callbacks. - Refactored test cases to standardize the detection endpoint responses and include channel IDs in headers for better event handling.
This commit is contained in:
+3
-3
@@ -645,6 +645,7 @@ async def detect_video_upload(
|
||||
content_hash, _MEDIA_STATUS_AI_PROCESSED,
|
||||
token_mgr.get_valid_token(),
|
||||
)
|
||||
await asyncio.sleep(0.01)
|
||||
_enqueue(channel_id, DetectionEvent(
|
||||
annotations=[],
|
||||
mediaId=content_hash,
|
||||
@@ -681,8 +682,7 @@ async def detect_media(
|
||||
config: Annotated[Optional[AIConfigDto], Body()] = None,
|
||||
user_id: str = Depends(require_auth),
|
||||
):
|
||||
existing = _active_detections.get(media_id)
|
||||
if existing is not None and not existing.done():
|
||||
if media_id in _active_detections:
|
||||
raise HTTPException(status_code=409, detail="Detection already in progress for this media")
|
||||
|
||||
channel_id = request.headers.get("x-channel-id", "")
|
||||
@@ -779,7 +779,7 @@ async def detect_media(
|
||||
)
|
||||
_enqueue(channel_id, error_event)
|
||||
finally:
|
||||
_active_detections.pop(media_id, None)
|
||||
loop.call_later(5.0, lambda: _active_detections.pop(media_id, None))
|
||||
loop.call_later(10.0, _cleanup_channel, channel_id)
|
||||
|
||||
_active_detections[media_id] = asyncio.create_task(run_detection())
|
||||
|
||||
Reference in New Issue
Block a user