Adarsh-Works-In-Data/EnterPriceLense

JavaScript

0

18 commits

updated May 11, 2026

See the code

README

๐Ÿ“ธ PhotoFinder V2 โ€” Enterprise Lens

Find any face. Find any object. Across millions of photos. In milliseconds.

PhotoFinder V2 (Enterprise Lens) is a production-grade visual search platform. Upload your photo library once, and from then on you can search it by face, by object, or by scene โ€” using nothing but a query image. It's built for event photographers, archivists, and anyone drowning in a photo library that's too large for human eyes.

The system runs a two-lane AI pipeline โ€” faces go through ArcFace + AdaFace (512-D embeddings, fused for accuracy), objects go through SigLIP + DINOv2 + YOLOv11-seg. Vectors live in Pinecone, images live in Cloudinary, identity clusters live in Supabase, and the whole stack is wired up so users bring their own keys (BYOK) โ€” no central data lake, no privacy compromise.


๐Ÿš€ Live Appphotofinderv2.vercel.app
๐ŸŽฌ Presentation WebsiteCanva-Presentation-link (includes blog, docs and walkthrough)
๐ŸฆŠ Frontend RepositoryGitLab โ€” photofinderv2/frontend (hosted on Vercel)
๐Ÿค— Backend APIadarshdrc-visual-search-api.hf.space (hosted on Hugging Face Spaces)

๐Ÿ‘‹ About the Author

Hi, I'm Adarsh โ€” the engineer behind Enterprise Lens. I built this project to push two-lane biometric retrieval onto a free-tier infra stack and prove it can hold its own against far more expensive setups.

๐Ÿ“ง Email[email protected]
๐Ÿ’ผ LinkedInlinkedin.com/in/adarsh-dau
๐Ÿ™ GitHubgithub.com/Adarsh-Works-In-Data
๐ŸฆŠ GitLabgitlab.com/adarsh.ambastha
๐Ÿค— Hugging Facehttps://huggingface.co/spaces/AdarshDRC
๐Ÿฆ X / Twitter@adarsh

โœจ What It Does

  • Face Search โ€” Upload a face photo, get every image of that person from your library back, sorted by similarity. Multi-angle search lets you upload front/left/right shots and fuses the embeddings server-side for one super-accurate query.
  • Object Search โ€” Find every photo containing a red sedan, a Labrador, a guitar, etc., using a query image of the object.
  • People View โ€” HDBSCAN automatically clusters your library by identity. You get an "album per person" view; rename clusters ("Mom", "Sarah") and they stick.
  • File Explorer โ€” Browse and manage your Cloudinary library by folder/category. Lightbox preview, scroll-to-zoom, click-to-close.
  • Bring Your Own Keys โ€” Users sign in with Google (Supabase Auth) and provide their own Pinecone + Cloudinary credentials. The backend never stores your photos or vectors centrally.
  • Admin Panel โ€” Privileged users get a system-wide dashboard for monitoring uploads, jobs, and logs.
  • Blog & Docs โ€” In-app engineering blog explaining design decisions (two-lane architecture, FAISS โ†’ Pinecone migration, sub-10ms latency at 50M vectors).

๐Ÿ— Architecture

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”         โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚   Frontend  (React 19 + Vite)   โ”‚         โ”‚       Backend  (FastAPI)         โ”‚
โ”‚                                 โ”‚  HTTPS  โ”‚                                  โ”‚
โ”‚   โ€ข Hosted on Vercel            โ”‚ โ”€โ”€โ”€โ”€โ”€โ”€โ–บ โ”‚   โ€ข Hosted on Hugging Face Spacesโ”‚
โ”‚   โ€ข Source on GitLab            โ”‚  CORS   โ”‚   โ€ข Docker image (Python 3.10)   โ”‚
โ”‚   โ€ข Supabase Auth (Google PKCE) โ”‚         โ”‚   โ€ข CPU-only inference (2 vCPU)  โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜         โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                                          โ”‚
                โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                โ”‚                                         โ”‚                                      โ”‚
                โ–ผ                                         โ–ผ                                      โ–ผ
    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”                  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”               โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
    โ”‚  AI Models (CPU)   โ”‚                  โ”‚  Vector DB โ€” Pinecone  โ”‚               โ”‚  Object Storage    โ”‚
    โ”‚                    โ”‚                  โ”‚                        โ”‚               โ”‚  Cloudinary CDN    โ”‚
    โ”‚  โ€ข SCRFD detector  โ”‚                  โ”‚  โ€ข faces-arcface (512) โ”‚               โ”‚                    โ”‚
    โ”‚  โ€ข ArcFace-R100    โ”‚                  โ”‚  โ€ข faces-adaface (512) โ”‚               โ”‚  โ€ข Image hosting   โ”‚
    โ”‚  โ€ข AdaFace         โ”‚                  โ”‚  โ€ข enterprise-objects  โ”‚               โ”‚  โ€ข Auto thumbnails โ”‚
    โ”‚  โ€ข SigLIP-B/16     โ”‚                  โ”‚    (fused 768-D)       โ”‚               โ”‚  โ€ข Folder browsing โ”‚
    โ”‚  โ€ข DINOv2-base     โ”‚                  โ”‚  Per-user keys (BYOK)  โ”‚               โ”‚  Per-user URL      โ”‚
    โ”‚  โ€ข YOLOv11-seg     โ”‚                  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜               โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
    โ”‚  ONNX-quantised    โ”‚
    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜                  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”               โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                                            โ”‚  Supabase (Postgres)   โ”‚               โ”‚  Upstash Redis     โ”‚
                                            โ”‚                        โ”‚               โ”‚                    โ”‚
                                            โ”‚  โ€ข user_settings       โ”‚               โ”‚  โ€ข Job queue       โ”‚
                                            โ”‚  โ€ข face_clusters       โ”‚               โ”‚  โ€ข Inference cache โ”‚
                                            โ”‚    (HDBSCAN output)    โ”‚               โ”‚  โ€ข Rate limiting   โ”‚
                                            โ”‚  โ€ข Auth + admin flags  โ”‚               โ”‚  REST API (HTTP)   โ”‚
                                            โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜               โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Two-Lane Inference

When an image arrives, we don't run one model. We run two parallel pipelines with separate semaphores so face detection and object embedding don't fight for the same CPU cores:

  1. Face lane โ€” SCRFD detects faces โ†’ align to ArcFace's 5-point template โ†’ embed with ArcFace-R100 โ†’ embed with AdaFace โ†’ store both 512-D vectors in two Pinecone indexes. At query time we score-fuse (0.6 ร— ArcFace + 0.4 ร— AdaFace, NIST-FRVT standard).
  2. Object lane โ€” YOLOv11-seg crops salient regions โ†’ SigLIP-B/16 + DINOv2-base run in parallel on each crop โ†’ concatenate to 768-D โ†’ store in Pinecone.

After indexing, HDBSCAN clusters all face vectors per user and writes the cluster IDs back to Supabase. Result: the "People View" tab and cluster-aware search โ€” when a face matches with high confidence, we expand the result set to include every image already known to belong to that identity cluster (near-100% recall on well-indexed people).


๐Ÿš€ Quick Start (For Users)

  1. Visit photofinderv2.vercel.app.
  2. Sign in with Google.
  3. Paste your Pinecone API key and your Cloudinary Environment URL in the onboarding modal. (Free-tier accounts work fine โ€” both providers have generous free plans.)
  4. Click Verify & Save. The backend will create the required indexes (faces-arcface, faces-adaface, enterprise-objects) on your Pinecone project automatically.
  5. Go to Upload โ†’ drag in some photos. Use Google Drive picker for bulk imports.
  6. Hop over to Search โ†’ drop a query image โ†’ done.

Privacy note: your keys are encrypted at rest in Supabase and only ever leave the browser to talk to your own Pinecone/Cloudinary projects. The backend is stateless w.r.t. your data โ€” it acts as an inference proxy.


๐Ÿง‘โ€๐Ÿ’ป Local Development

This monorepo holds both codebases. See the per-folder READMEs for full instructions:

TL;DR:

# Frontend
cd frontend
npm install
cp .env.local.example .env.local        # then fill in your Supabase keys
npm run dev                              # http://localhost:5173

# Backend
cd ../backend
cp .env.example .env                     # then fill in your secrets
docker build -t enterprise-lens .
docker run -p 7860:7860 --env-file .env enterprise-lens

๐Ÿ›  Tech Stack

LayerTooling
FrontendReact 19, Vite 7, vanilla CSS (theme-token driven), Supabase JS SDK
AuthSupabase Auth (Google OAuth, PKCE flow)
BackendFastAPI, Uvicorn, Python 3.10, Docker
AI / MLPyTorch CPU, ONNX Runtime, InsightFace (SCRFD + ArcFace), AdaFace, SigLIP, DINOv2, YOLOv11-seg, HDBSCAN
Vector DBPinecone Serverless
StorageCloudinary
Metadata DBSupabase Postgres
Cache / QueueUpstash Redis (HTTP REST)
HostingVercel (frontend) ยท Hugging Face Spaces (backend, free CPU tier)
ReposGitLab (frontend) ยท HF Spaces (backend)

๐Ÿ“‚ Repo Layout

photofinderv2/
โ”œโ”€โ”€ frontend/                      # React 19 SPA โ€” see frontend/README.md
โ”‚   โ”œโ”€โ”€ src/
โ”‚   โ”‚   โ”œโ”€โ”€ App.jsx                # Tab router + auth state
โ”‚   โ”‚   โ”œโ”€โ”€ components/            # home, search, upload, people, explorer, settings, admin, blog, docs
โ”‚   โ”‚   โ”œโ”€โ”€ context/               # GlobalDBContext (encrypted key storage)
โ”‚   โ”‚   โ”œโ”€โ”€ hooks/                 # useDrivePicker, useLogger, useTheme, useSound, useReveal
โ”‚   โ”‚   โ”œโ”€โ”€ utils/                 # api.js, constants.js, soundEngine, helpers
โ”‚   โ”‚   โ”œโ”€โ”€ supabaseClient.js      # PKCE-mode Supabase client
โ”‚   โ”‚   โ””โ”€โ”€ App.css                # Theme tokens + global styles
โ”‚   โ”œโ”€โ”€ package.json               # Vite + React 19, no Tailwind
โ”‚   โ”œโ”€โ”€ vite.config.js
โ”‚   โ””โ”€โ”€ .env.local.example         # Copy to .env.local and fill in
โ”‚
โ”œโ”€โ”€ backend/                       # FastAPI inference service โ€” see backend/README.md
โ”‚   โ”œโ”€โ”€ main.py                    # FastAPI app + lifespan (model loading, semaphores)
โ”‚   โ”œโ”€โ”€ src/
โ”‚   โ”‚   โ”œโ”€โ”€ api/                   # Routers โ€” system, search, upload, explorer, people, jobs, danger
โ”‚   โ”‚   โ”œโ”€โ”€ core/                  # config, security (BYOK key parsing), logging
โ”‚   โ”‚   โ”œโ”€โ”€ services/              # ai_manager, db_client, clustering, jobs, cache, onnx_models
โ”‚   โ”‚   โ””โ”€โ”€ common/                # Shared utilities
โ”‚   โ”œโ”€โ”€ scripts/                   # convert_to_onnx.py, calibrate_threshold.py, โ€ฆ
โ”‚   โ”œโ”€โ”€ Dockerfile                 # Python 3.10-slim โ€” builds ONNX models at image build
โ”‚   โ”œโ”€โ”€ requirements.txt
โ”‚   โ””โ”€โ”€ .env.example               # Copy to .env and fill in
โ”‚
โ”œโ”€โ”€ .gitlab-ci.yml                 # CI โ€” HF Spaces warmup ping
โ”œโ”€โ”€ LICENSE                        # MIT
โ””โ”€โ”€ README.md                      # โ† you are here

The backend (FastAPI) lives in backend/ and is mirrored to Hugging Face Spaces for deployment. See backend/README.md for endpoint docs and deployment instructions.


๐Ÿ“œ License

MIT โ€” feel free to fork, learn, and remix.


๐Ÿ™ Credits

Built by Adarsh during a deep-dive into modern face/object retrieval. Special thanks to the maintainers of InsightFace, AdaFace, SigLIP, DINOv2, and Ultralytics โ€” without their open weights, none of this would be free.

Got questions, ideas, or want to collaborate? Email me at [email protected].

Adarsh-Works-In-Data/EnterPriceLense

JavaScript

0

18 commits

updated May 11, 2026

See the code

README

๐Ÿ“ธ PhotoFinder V2 โ€” Enterprise Lens

Find any face. Find any object. Across millions of photos. In milliseconds.

PhotoFinder V2 (Enterprise Lens) is a production-grade visual search platform. Upload your photo library once, and from then on you can search it by face, by object, or by scene โ€” using nothing but a query image. It's built for event photographers, archivists, and anyone drowning in a photo library that's too large for human eyes.

The system runs a two-lane AI pipeline โ€” faces go through ArcFace + AdaFace (512-D embeddings, fused for accuracy), objects go through SigLIP + DINOv2 + YOLOv11-seg. Vectors live in Pinecone, images live in Cloudinary, identity clusters live in Supabase, and the whole stack is wired up so users bring their own keys (BYOK) โ€” no central data lake, no privacy compromise.


๐Ÿš€ Live Appphotofinderv2.vercel.app
๐ŸŽฌ Presentation WebsiteCanva-Presentation-link (includes blog, docs and walkthrough)
๐ŸฆŠ Frontend RepositoryGitLab โ€” photofinderv2/frontend (hosted on Vercel)
๐Ÿค— Backend APIadarshdrc-visual-search-api.hf.space (hosted on Hugging Face Spaces)

๐Ÿ‘‹ About the Author

Hi, I'm Adarsh โ€” the engineer behind Enterprise Lens. I built this project to push two-lane biometric retrieval onto a free-tier infra stack and prove it can hold its own against far more expensive setups.

๐Ÿ“ง Email[email protected]
๐Ÿ’ผ LinkedInlinkedin.com/in/adarsh-dau
๐Ÿ™ GitHubgithub.com/Adarsh-Works-In-Data
๐ŸฆŠ GitLabgitlab.com/adarsh.ambastha
๐Ÿค— Hugging Facehttps://huggingface.co/spaces/AdarshDRC
๐Ÿฆ X / Twitter@adarsh

โœจ What It Does

  • Face Search โ€” Upload a face photo, get every image of that person from your library back, sorted by similarity. Multi-angle search lets you upload front/left/right shots and fuses the embeddings server-side for one super-accurate query.
  • Object Search โ€” Find every photo containing a red sedan, a Labrador, a guitar, etc., using a query image of the object.
  • People View โ€” HDBSCAN automatically clusters your library by identity. You get an "album per person" view; rename clusters ("Mom", "Sarah") and they stick.
  • File Explorer โ€” Browse and manage your Cloudinary library by folder/category. Lightbox preview, scroll-to-zoom, click-to-close.
  • Bring Your Own Keys โ€” Users sign in with Google (Supabase Auth) and provide their own Pinecone + Cloudinary credentials. The backend never stores your photos or vectors centrally.
  • Admin Panel โ€” Privileged users get a system-wide dashboard for monitoring uploads, jobs, and logs.
  • Blog & Docs โ€” In-app engineering blog explaining design decisions (two-lane architecture, FAISS โ†’ Pinecone migration, sub-10ms latency at 50M vectors).

๐Ÿ— Architecture

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”         โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚   Frontend  (React 19 + Vite)   โ”‚         โ”‚       Backend  (FastAPI)         โ”‚
โ”‚                                 โ”‚  HTTPS  โ”‚                                  โ”‚
โ”‚   โ€ข Hosted on Vercel            โ”‚ โ”€โ”€โ”€โ”€โ”€โ”€โ–บ โ”‚   โ€ข Hosted on Hugging Face Spacesโ”‚
โ”‚   โ€ข Source on GitLab            โ”‚  CORS   โ”‚   โ€ข Docker image (Python 3.10)   โ”‚
โ”‚   โ€ข Supabase Auth (Google PKCE) โ”‚         โ”‚   โ€ข CPU-only inference (2 vCPU)  โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜         โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                                          โ”‚
                โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                โ”‚                                         โ”‚                                      โ”‚
                โ–ผ                                         โ–ผ                                      โ–ผ
    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”                  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”               โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
    โ”‚  AI Models (CPU)   โ”‚                  โ”‚  Vector DB โ€” Pinecone  โ”‚               โ”‚  Object Storage    โ”‚
    โ”‚                    โ”‚                  โ”‚                        โ”‚               โ”‚  Cloudinary CDN    โ”‚
    โ”‚  โ€ข SCRFD detector  โ”‚                  โ”‚  โ€ข faces-arcface (512) โ”‚               โ”‚                    โ”‚
    โ”‚  โ€ข ArcFace-R100    โ”‚                  โ”‚  โ€ข faces-adaface (512) โ”‚               โ”‚  โ€ข Image hosting   โ”‚
    โ”‚  โ€ข AdaFace         โ”‚                  โ”‚  โ€ข enterprise-objects  โ”‚               โ”‚  โ€ข Auto thumbnails โ”‚
    โ”‚  โ€ข SigLIP-B/16     โ”‚                  โ”‚    (fused 768-D)       โ”‚               โ”‚  โ€ข Folder browsing โ”‚
    โ”‚  โ€ข DINOv2-base     โ”‚                  โ”‚  Per-user keys (BYOK)  โ”‚               โ”‚  Per-user URL      โ”‚
    โ”‚  โ€ข YOLOv11-seg     โ”‚                  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜               โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
    โ”‚  ONNX-quantised    โ”‚
    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜                  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”               โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                                            โ”‚  Supabase (Postgres)   โ”‚               โ”‚  Upstash Redis     โ”‚
                                            โ”‚                        โ”‚               โ”‚                    โ”‚
                                            โ”‚  โ€ข user_settings       โ”‚               โ”‚  โ€ข Job queue       โ”‚
                                            โ”‚  โ€ข face_clusters       โ”‚               โ”‚  โ€ข Inference cache โ”‚
                                            โ”‚    (HDBSCAN output)    โ”‚               โ”‚  โ€ข Rate limiting   โ”‚
                                            โ”‚  โ€ข Auth + admin flags  โ”‚               โ”‚  REST API (HTTP)   โ”‚
                                            โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜               โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Two-Lane Inference

When an image arrives, we don't run one model. We run two parallel pipelines with separate semaphores so face detection and object embedding don't fight for the same CPU cores:

  1. Face lane โ€” SCRFD detects faces โ†’ align to ArcFace's 5-point template โ†’ embed with ArcFace-R100 โ†’ embed with AdaFace โ†’ store both 512-D vectors in two Pinecone indexes. At query time we score-fuse (0.6 ร— ArcFace + 0.4 ร— AdaFace, NIST-FRVT standard).
  2. Object lane โ€” YOLOv11-seg crops salient regions โ†’ SigLIP-B/16 + DINOv2-base run in parallel on each crop โ†’ concatenate to 768-D โ†’ store in Pinecone.

After indexing, HDBSCAN clusters all face vectors per user and writes the cluster IDs back to Supabase. Result: the "People View" tab and cluster-aware search โ€” when a face matches with high confidence, we expand the result set to include every image already known to belong to that identity cluster (near-100% recall on well-indexed people).


๐Ÿš€ Quick Start (For Users)

  1. Visit photofinderv2.vercel.app.
  2. Sign in with Google.
  3. Paste your Pinecone API key and your Cloudinary Environment URL in the onboarding modal. (Free-tier accounts work fine โ€” both providers have generous free plans.)
  4. Click Verify & Save. The backend will create the required indexes (faces-arcface, faces-adaface, enterprise-objects) on your Pinecone project automatically.
  5. Go to Upload โ†’ drag in some photos. Use Google Drive picker for bulk imports.
  6. Hop over to Search โ†’ drop a query image โ†’ done.

Privacy note: your keys are encrypted at rest in Supabase and only ever leave the browser to talk to your own Pinecone/Cloudinary projects. The backend is stateless w.r.t. your data โ€” it acts as an inference proxy.


๐Ÿง‘โ€๐Ÿ’ป Local Development

This monorepo holds both codebases. See the per-folder READMEs for full instructions:

TL;DR:

# Frontend
cd frontend
npm install
cp .env.local.example .env.local        # then fill in your Supabase keys
npm run dev                              # http://localhost:5173

# Backend
cd ../backend
cp .env.example .env                     # then fill in your secrets
docker build -t enterprise-lens .
docker run -p 7860:7860 --env-file .env enterprise-lens

๐Ÿ›  Tech Stack

LayerTooling
FrontendReact 19, Vite 7, vanilla CSS (theme-token driven), Supabase JS SDK
AuthSupabase Auth (Google OAuth, PKCE flow)
BackendFastAPI, Uvicorn, Python 3.10, Docker
AI / MLPyTorch CPU, ONNX Runtime, InsightFace (SCRFD + ArcFace), AdaFace, SigLIP, DINOv2, YOLOv11-seg, HDBSCAN
Vector DBPinecone Serverless
StorageCloudinary
Metadata DBSupabase Postgres
Cache / QueueUpstash Redis (HTTP REST)
HostingVercel (frontend) ยท Hugging Face Spaces (backend, free CPU tier)
ReposGitLab (frontend) ยท HF Spaces (backend)

๐Ÿ“‚ Repo Layout

photofinderv2/
โ”œโ”€โ”€ frontend/                      # React 19 SPA โ€” see frontend/README.md
โ”‚   โ”œโ”€โ”€ src/
โ”‚   โ”‚   โ”œโ”€โ”€ App.jsx                # Tab router + auth state
โ”‚   โ”‚   โ”œโ”€โ”€ components/            # home, search, upload, people, explorer, settings, admin, blog, docs
โ”‚   โ”‚   โ”œโ”€โ”€ context/               # GlobalDBContext (encrypted key storage)
โ”‚   โ”‚   โ”œโ”€โ”€ hooks/                 # useDrivePicker, useLogger, useTheme, useSound, useReveal
โ”‚   โ”‚   โ”œโ”€โ”€ utils/                 # api.js, constants.js, soundEngine, helpers
โ”‚   โ”‚   โ”œโ”€โ”€ supabaseClient.js      # PKCE-mode Supabase client
โ”‚   โ”‚   โ””โ”€โ”€ App.css                # Theme tokens + global styles
โ”‚   โ”œโ”€โ”€ package.json               # Vite + React 19, no Tailwind
โ”‚   โ”œโ”€โ”€ vite.config.js
โ”‚   โ””โ”€โ”€ .env.local.example         # Copy to .env.local and fill in
โ”‚
โ”œโ”€โ”€ backend/                       # FastAPI inference service โ€” see backend/README.md
โ”‚   โ”œโ”€โ”€ main.py                    # FastAPI app + lifespan (model loading, semaphores)
โ”‚   โ”œโ”€โ”€ src/
โ”‚   โ”‚   โ”œโ”€โ”€ api/                   # Routers โ€” system, search, upload, explorer, people, jobs, danger
โ”‚   โ”‚   โ”œโ”€โ”€ core/                  # config, security (BYOK key parsing), logging
โ”‚   โ”‚   โ”œโ”€โ”€ services/              # ai_manager, db_client, clustering, jobs, cache, onnx_models
โ”‚   โ”‚   โ””โ”€โ”€ common/                # Shared utilities
โ”‚   โ”œโ”€โ”€ scripts/                   # convert_to_onnx.py, calibrate_threshold.py, โ€ฆ
โ”‚   โ”œโ”€โ”€ Dockerfile                 # Python 3.10-slim โ€” builds ONNX models at image build
โ”‚   โ”œโ”€โ”€ requirements.txt
โ”‚   โ””โ”€โ”€ .env.example               # Copy to .env and fill in
โ”‚
โ”œโ”€โ”€ .gitlab-ci.yml                 # CI โ€” HF Spaces warmup ping
โ”œโ”€โ”€ LICENSE                        # MIT
โ””โ”€โ”€ README.md                      # โ† you are here

The backend (FastAPI) lives in backend/ and is mirrored to Hugging Face Spaces for deployment. See backend/README.md for endpoint docs and deployment instructions.


๐Ÿ“œ License

MIT โ€” feel free to fork, learn, and remix.


๐Ÿ™ Credits

Built by Adarsh during a deep-dive into modern face/object retrieval. Special thanks to the maintainers of InsightFace, AdaFace, SigLIP, DINOv2, and Ultralytics โ€” without their open weights, none of this would be free.

Got questions, ideas, or want to collaborate? Email me at [email protected].