Spaces:
Running
Running
Update backend/README.md
#17
by
munals - opened
- backend/README.md +12 -11
backend/README.md
CHANGED
|
@@ -18,10 +18,10 @@ HaramGuard/
|
|
| 18 |
βββ agents/ β One file per agent
|
| 19 |
β βββ __init__.py
|
| 20 |
β βββ perception_agent.py β YOLO tracking + Guardrails GR1/GR2
|
| 21 |
-
β βββ risk_agent.py β
|
| 22 |
β βββ reflection_agent.py β Self-critique design pattern (Bias detection)
|
| 23 |
β βββ operations_agent.py β Event-driven playbook + rate-limit guardrail
|
| 24 |
-
β βββ coordinator_agent.py β
|
| 25 |
β
|
| 26 |
βββ outputs/ β Auto-created at runtime
|
| 27 |
βββ hajjflow_rt.db β Main SQLite database
|
|
@@ -37,16 +37,16 @@ Frame
|
|
| 37 |
PerceptionAgent β FrameResult (YOLO detect + track)
|
| 38 |
β
|
| 39 |
βΌ
|
| 40 |
-
RiskAgent β RiskResult (
|
| 41 |
β
|
| 42 |
βΌ
|
| 43 |
ReflectionAgent β reflection{} (bias check + correction)
|
| 44 |
β
|
| 45 |
βΌ
|
| 46 |
OperationsAgent β Decision (event-driven, P0/P1/P2)
|
| 47 |
-
β
|
| 48 |
βΌ
|
| 49 |
-
CoordinatorAgent β plan{} (
|
| 50 |
β
|
| 51 |
βΌ
|
| 52 |
pipeline.state β Dashboard
|
|
@@ -58,9 +58,10 @@ pipeline.state β Dashboard
|
|
| 58 |
|----|-------|-------------|
|
| 59 |
| GR1 | PerceptionAgent | Person count capped at 500 |
|
| 60 |
| GR2 | PerceptionAgent | Density score capped at 50 |
|
| 61 |
-
| GR3 | RiskAgent | Risk score clamped to [0, 1] |
|
| 62 |
-
|
|
| 63 |
-
|
|
|
|
|
| 64 |
| RF1..3 | ReflectionAgent | Chronic LOW bias, rising trend ignored, count-risk mismatch |
|
| 65 |
|
| 66 |
## π Run Evaluation
|
|
@@ -81,9 +82,9 @@ Rubric coverage:
|
|
| 81 |
- β
Error analysis methodology (Section 6)
|
| 82 |
- β
Evidence of iterative improvement (Section 7)
|
| 83 |
|
| 84 |
-
## π Run
|
| 85 |
|
| 86 |
```bash
|
| 87 |
pip install -r requirements.txt
|
| 88 |
-
|
| 89 |
-
```
|
|
|
|
| 18 |
βββ agents/ β One file per agent
|
| 19 |
β βββ __init__.py
|
| 20 |
β βββ perception_agent.py β YOLO tracking + Guardrails GR1/GR2
|
| 21 |
+
β βββ risk_agent.py β Clip segmentation + sliding K-window density scoring
|
| 22 |
β βββ reflection_agent.py β Self-critique design pattern (Bias detection)
|
| 23 |
β βββ operations_agent.py β Event-driven playbook + rate-limit guardrail
|
| 24 |
+
β βββ coordinator_agent.py β openai/gpt-oss-120b + output validation guardrails GR-C1..5
|
| 25 |
β
|
| 26 |
βββ outputs/ β Auto-created at runtime
|
| 27 |
βββ hajjflow_rt.db β Main SQLite database
|
|
|
|
| 37 |
PerceptionAgent β FrameResult (YOLO detect + track)
|
| 38 |
β
|
| 39 |
βΌ
|
| 40 |
+
RiskAgent β RiskResult (clip segmentation + K-window density score)
|
| 41 |
β
|
| 42 |
βΌ
|
| 43 |
ReflectionAgent β reflection{} (bias check + correction)
|
| 44 |
β
|
| 45 |
βΌ
|
| 46 |
OperationsAgent β Decision (event-driven, P0/P1/P2)
|
| 47 |
+
β
|
| 48 |
βΌ
|
| 49 |
+
CoordinatorAgent β plan{} (openai/gpt-oss-120b action plan, all priorities)
|
| 50 |
β
|
| 51 |
βΌ
|
| 52 |
pipeline.state β Dashboard
|
|
|
|
| 58 |
|----|-------|-------------|
|
| 59 |
| GR1 | PerceptionAgent | Person count capped at 500 |
|
| 60 |
| GR2 | PerceptionAgent | Density score capped at 50 |
|
| 61 |
+
| GR3 | RiskAgent | Risk score clamped to [0, 1] (density_pct / 100) |
|
| 62 |
+
| GR3b | RiskAgent | level_changed suppressed during K-window warmup (first 17 frames per clip) |
|
| 63 |
+
| GR4 | OperationsAgent | P0 rate-limited (1 per 5 min per zone); resets on pipeline restart |
|
| 64 |
+
| GR-C1..5 | CoordinatorAgent | LLM output validation (fields, threat_level, confidence, score-level consistency, Arabic fallback) |
|
| 65 |
| RF1..3 | ReflectionAgent | Chronic LOW bias, rising trend ignored, count-risk mismatch |
|
| 66 |
|
| 67 |
## π Run Evaluation
|
|
|
|
| 82 |
- β
Error analysis methodology (Section 6)
|
| 83 |
- β
Evidence of iterative improvement (Section 7)
|
| 84 |
|
| 85 |
+
## π Run Backend API
|
| 86 |
|
| 87 |
```bash
|
| 88 |
pip install -r requirements.txt
|
| 89 |
+
python api.py
|
| 90 |
+
```
|