Spaces:
Sleeping
Sleeping
Add README.md
Browse files
README.md
CHANGED
|
@@ -1,10 +1,51 @@
|
|
| 1 |
---
|
| 2 |
-
title: Civic
|
| 3 |
-
emoji:
|
| 4 |
colorFrom: blue
|
| 5 |
-
colorTo:
|
| 6 |
sdk: docker
|
|
|
|
|
|
|
| 7 |
pinned: false
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
---
|
| 9 |
|
| 10 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
+
title: Civic ML Backend
|
| 3 |
+
emoji: 🏛️
|
| 4 |
colorFrom: blue
|
| 5 |
+
colorTo: purple
|
| 6 |
sdk: docker
|
| 7 |
+
sdk_version: 20.10.9
|
| 8 |
+
app_file: Dockerfile
|
| 9 |
pinned: false
|
| 10 |
+
license: mit
|
| 11 |
+
tags:
|
| 12 |
+
- civic-services
|
| 13 |
+
- machine-learning
|
| 14 |
+
- fastapi
|
| 15 |
+
- image-classification
|
| 16 |
+
- duplicate-detection
|
| 17 |
+
- clip
|
| 18 |
+
- civics
|
| 19 |
+
- backend
|
| 20 |
+
language:
|
| 21 |
+
- code
|
| 22 |
+
- en
|
| 23 |
+
library_name: fastapi
|
| 24 |
+
pipeline_tag: image-classification
|
| 25 |
---
|
| 26 |
|
| 27 |
+
# Civic ML Backend (Full: pHash + Location)
|
| 28 |
+
|
| 29 |
+
## Overview:
|
| 30 |
+
|
| 31 |
+
- FastAPI backend that accepts citizen reports and performs:
|
| 32 |
+
- rule-based abuse detection
|
| 33 |
+
- text duplicate detection
|
| 34 |
+
- image duplicate detection using pHash (imagehash)
|
| 35 |
+
- location-based duplicate detection using Haversine formula
|
| 36 |
+
- image classification using CLIP (if available) with URL fallback
|
| 37 |
+
- priority detection (keyword-based)
|
| 38 |
+
|
| 39 |
+
Run:
|
| 40 |
+
|
| 41 |
+
1. python3 -m venv .venv
|
| 42 |
+
2. source .venv/bin/activate # Windows: c
|
| 43 |
+
3. pip install -r requirements.txt
|
| 44 |
+
4. uvicorn app.main:app --reload --port 8000
|
| 45 |
+
|
| 46 |
+
Notes:
|
| 47 |
+
|
| 48 |
+
- The in-memory stores (seen_reports, seen_image_hashes, seen_locations) are ephemeral and reset on server restart.
|
| 49 |
+
- CLIP model download requires internet and may take time; if unavailable, the system uses URL keyword fallback for image labels.
|
| 50 |
+
- data/dataset.jsonl collects all incoming reports and results for later training/audit.
|
| 51 |
+
# civic-ml
|