How soumadeep46/sarvadrishthi works
Project Type and Purpose
• Sarvadrishti is a full-stack, locally hosted web application built with Streamlit (frontend) and Python (backend) that performs decentralized facial recognition for law enforcement.
• It leverages AI/ML (OpenCV, face_recognition), decentralized storage (IPFS via Pinata Cloud), local CSV for offline operation, and JWT+encryption for security.
File Structure
• Top-level files:
• app.py → single entry point combining UI and backend logic
• requirements.txt → Python dependencies (Streamlit, OpenCV, face_recognition, web3/IPFS libraries, JWT, encryption libs)
• .env → secrets (Pinata API key, JWT secret)
• No separate “frontend” or “backend” folders means the app is monolithic but internally layered.
a. Client (Browser/Terminal)
b. Streamlit Frontend (UI layer inside app.py)
c. Authentication Module
• JWT generator/validator
• Encryption/decryption routines
d. Facial Recognition Engine
• Uses OpenCV & face_recognition libraries
e. Data Manager
• Local CSV handler (offline DB)
• IPFS Manager (Pinata API client)
f. External IPFS Network (Pinata Cloud & peer nodes)
g. Hosting Environment
• Local machine/VM/container, offline-capable
Relationships & Data Flows
• Client → Streamlit UI: HTTP(S) request to upload/query face image
• Streamlit UI → Auth Module: attach/validate JWT, decrypt payload
• UI → Facial Recognition Engine: pass image for feature extraction
• Recognition Engine ↔ Data Manager:
• Query: CSV first → if not found → Pinata/IPFS API call → IPFS network
• Store new record: encrypt data → send to Pinata → pin on IPFS
• Data Manager → Pinata Cloud → IPFS Network (decentralized storage)
• Recognition results → Streamlit UI → Client
Architectural Patterns & Principles
• Layered architecture: UI → Business logic (Auth + Recognition) → Data layer
• Offline-first design: local CSV as fallback for environment with no internet
• Decentralized storage pattern: IPFS for redundancy and security
• Security-first: JWT for access control, end-to-end encryption