civic-ml-backend / README.md
mohxn49's picture
Add README.md
1b0c2e1 verified
metadata
title: Civic ML Backend
emoji: 🏛️
colorFrom: blue
colorTo: purple
sdk: docker
sdk_version: 20.10.9
app_file: Dockerfile
pinned: false
license: mit
tags:
  - civic-services
  - machine-learning
  - fastapi
  - image-classification
  - duplicate-detection
  - clip
  - civics
  - backend
language:
  - code
  - en
library_name: fastapi
pipeline_tag: image-classification

Civic ML Backend (Full: pHash + Location)

Overview:

  • FastAPI backend that accepts citizen reports and performs:
    • rule-based abuse detection
    • text duplicate detection
    • image duplicate detection using pHash (imagehash)
    • location-based duplicate detection using Haversine formula
    • image classification using CLIP (if available) with URL fallback
    • priority detection (keyword-based)

Run:

  1. python3 -m venv .venv
  2. source .venv/bin/activate # Windows: c
  3. pip install -r requirements.txt
  4. uvicorn app.main:app --reload --port 8000

Notes:

  • The in-memory stores (seen_reports, seen_image_hashes, seen_locations) are ephemeral and reset on server restart.
  • CLIP model download requires internet and may take time; if unavailable, the system uses URL keyword fallback for image labels.
  • data/dataset.jsonl collects all incoming reports and results for later training/audit.

civic-ml