mirror of
https://github.com/azaion/detections.git
synced 2026-04-22 17:46:38 +00:00
Refactor inference and AI configuration handling
- Updated the `Inference` class to replace the `get_onnx_engine_bytes` method with `download_model`, allowing for dynamic model loading based on a specified filename. - Modified the `convert_and_upload_model` method to accept `source_bytes` instead of `onnx_engine_bytes`, enhancing flexibility in model conversion. - Introduced a new property `engine_name` to the `Inference` class for better access to engine details. - Adjusted the `AIRecognitionConfig` structure to include a new method pointer `from_dict`, improving configuration handling. - Updated various test cases to reflect changes in model paths and timeout settings, ensuring consistency and reliability in testing.
This commit is contained in:
@@ -16,7 +16,7 @@ def _ai_config_video() -> dict:
|
||||
"altitude": 400,
|
||||
"focal_length": 24,
|
||||
"sensor_width": 23.5,
|
||||
"paths": [f"{_MEDIA}/video_short01.mp4"],
|
||||
"paths": [f"{_MEDIA}/video_test01.mp4"],
|
||||
"frame_period_recognition": 4,
|
||||
"frame_recognition_seconds": 2,
|
||||
}
|
||||
@@ -47,7 +47,7 @@ def test_ft_p08_immediate_async_response(
|
||||
|
||||
|
||||
@pytest.mark.slow
|
||||
@pytest.mark.timeout(120)
|
||||
@pytest.mark.timeout(300)
|
||||
def test_ft_p09_sse_event_delivery(
|
||||
warm_engine, http_client, jwt_token, sse_client_factory
|
||||
):
|
||||
@@ -84,8 +84,8 @@ def test_ft_p09_sse_event_delivery(
|
||||
time.sleep(0.5)
|
||||
r = http_client.post(f"/detect/{media_id}", json=body, headers=headers)
|
||||
assert r.status_code == 200
|
||||
ok = done.wait(timeout=120)
|
||||
assert ok, "SSE listener did not finish within 120s"
|
||||
ok = done.wait(timeout=290)
|
||||
assert ok, "SSE listener did not finish within 290s"
|
||||
th.join(timeout=5)
|
||||
assert not thread_exc, thread_exc
|
||||
assert collected, "no SSE events received"
|
||||
|
||||
Reference in New Issue
Block a user