feat: sync live-count, exemplar annotation modules, and update .gitignore

This commit is contained in:
ervanfahriaw committed 2026-08-24 14:57:42 +07:00
1 parent b6624eeff9
commit ac95674c07
39 files changed
+3979 -444

No files matched your search

+37
View File
@@ -40,6 +40,25 @@ class AssistRequest(BaseModel):
threshold: float = 0.5
class PoolExemplar(BaseModel):
# Normalized xyxy against the frame, as drawn on the review canvas.
box: List[float]
positive: bool = True
class ExemplarLabelRequest(BaseModel):
# The whole frame-local pool, newest last (REQ-173/174).
exemplars: List[PoolExemplar]
class_id: int = 0
# The filter panel (REQ-175). Defaults mirror `exemplar.DEFAULTS`.
threshold: float = 0.5
iou_threshold: float = 0.8
min_box_frac: float = 0.002
max_detections: int = 100
# Off by default: a drag previews, only Apply writes.
apply: bool = False
@router.get("/api/frames/{frame_id}/annotations")
def list_annotations(frame_id: int) -> dict:
target = review_store.frame(frame_id)
@@ -99,6 +118,24 @@ def assist(frame_id: int, request: AssistRequest) -> dict:
raise HTTPException(400, str(exc))
@router.post("/api/frames/{frame_id}/exemplar-label")
def exemplar_label(frame_id: int, request: ExemplarLabelRequest) -> dict:
from backend import exemplar as exemplar_store
try:
return exemplar_store.label(
frame_id, request.class_id,
[item.model_dump() for item in request.exemplars],
threshold=request.threshold,
iou_threshold=request.iou_threshold,
min_box_frac=request.min_box_frac,
max_detections=request.max_detections,
apply=request.apply,
)
except review_store.ReviewError as exc:
raise HTTPException(400, str(exc))
@router.post("/api/frames/{frame_id}/status")
def set_status(frame_id: int, request: StatusRequest) -> dict:
try: