[AZ-180] Refactor detection event handling and improve SSE support

- Updated the detection image endpoint to require a channel ID for event streaming.
- Introduced a new endpoint for streaming detection events, allowing clients to receive real-time updates.
- Enhanced the internal buffering mechanism for detection events to manage multiple channels.
- Refactored the inference module to support the new event handling structure.

Made-with: Cursor
This commit is contained in:
Oleksandr Bezdieniezhnykh
2026-04-03 02:42:05 +03:00
parent 2c35e59a77
commit 8baa96978b
26 changed files with 819 additions and 413 deletions
+8 -18
View File
@@ -28,32 +28,22 @@ def _assert_no_same_label_near_duplicate_centers(detections):
@pytest.mark.slow
def test_ft_p_04_gsd_based_tiling_ac1(http_client, image_large, warm_engine, auth_headers):
config = json.dumps(_GSD)
r = http_client.post(
"/detect/image",
files={"file": ("img.jpg", image_large, "image/jpeg")},
data={"config": config},
headers=auth_headers,
def test_ft_p_04_gsd_based_tiling_ac1(image_detect, image_large, warm_engine):
body, _ = image_detect(
image_large, "img.jpg",
config=json.dumps(_GSD),
timeout=_TILING_TIMEOUT,
)
assert r.status_code == 200
body = r.json()
assert isinstance(body, list)
_assert_coords_normalized(body)
@pytest.mark.slow
def test_ft_p_16_tile_boundary_deduplication_ac2(http_client, image_large, warm_engine, auth_headers):
config = json.dumps({**_GSD, "big_image_tile_overlap_percent": 20})
r = http_client.post(
"/detect/image",
files={"file": ("img.jpg", image_large, "image/jpeg")},
data={"config": config},
headers=auth_headers,
def test_ft_p_16_tile_boundary_deduplication_ac2(image_detect, image_large, warm_engine):
body, _ = image_detect(
image_large, "img.jpg",
config=json.dumps({**_GSD, "big_image_tile_overlap_percent": 20}),
timeout=_TILING_TIMEOUT,
)
assert r.status_code == 200
body = r.json()
assert isinstance(body, list)
_assert_no_same_label_near_duplicate_centers(body)