phase 6
This commit is contained in:
@@ -7,6 +7,8 @@ Each node emits graph_update events so the UI can visualize transitions.
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
|
||||
from langgraph.graph import END, StateGraph
|
||||
|
||||
from detect import emit
|
||||
@@ -15,6 +17,9 @@ from detect.profiles import SoccerBroadcastProfile
|
||||
from detect.state import DetectState
|
||||
from detect.stages.frame_extractor import extract_frames
|
||||
from detect.stages.scene_filter import scene_filter
|
||||
from detect.stages.yolo_detector import detect_objects
|
||||
|
||||
INFERENCE_URL = os.environ.get("INFERENCE_URL") # None = local mode
|
||||
|
||||
NODES = [
|
||||
"extract_frames",
|
||||
@@ -84,10 +89,19 @@ def node_filter_scenes(state: DetectState) -> dict:
|
||||
|
||||
def node_detect_objects(state: DetectState) -> dict:
|
||||
_emit_transition(state, "detect_objects", "running")
|
||||
|
||||
profile = _get_profile(state)
|
||||
config = profile.detection_config()
|
||||
frames = state.get("filtered_frames", [])
|
||||
job_id = state.get("job_id")
|
||||
emit.log(job_id, "YOLODetector", "INFO", "Stub: object detection not yet implemented")
|
||||
|
||||
all_boxes = detect_objects(frames, config, inference_url=INFERENCE_URL, job_id=job_id)
|
||||
|
||||
stats = state.get("stats", PipelineStats())
|
||||
stats.regions_detected = sum(len(boxes) for boxes in all_boxes.values())
|
||||
|
||||
_emit_transition(state, "detect_objects", "done")
|
||||
return {}
|
||||
return {"stats": stats}
|
||||
|
||||
|
||||
def node_run_ocr(state: DetectState) -> dict:
|
||||
|
||||
Reference in New Issue
Block a user