CoolFace
Apppublic

scythe410/vectorscape-reducer

sourceHugging Faceupdated 4mo agoView on Hugging Face
0likes
App README

VectorScape Reducer

FastAPI service that turns text rows into 3D coordinates + clusters for the VectorScape web app. The web app calls this service over HTTPS with a shared secret in the X-Reducer-Secret header.

Endpoints

  • —GET /health — liveness probe (unauthenticated).
  • —POST /embed-reduce — embed → optional PCA → PaCMAP/UMAP → HDBSCAN, then write points + clusters rows to Supabase. Requires X-Reducer-Secret.
  • —GET /status/{project_id} — poll project status. Requires X-Reducer-Secret.
  • —POST /bridge — explain the gap between two clusters via LLM. Requires X-Reducer-Secret.

Required environment

Set these as secrets in the Space settings (Settings → Variables and secrets):

NamePurpose
REDUCER_SHARED_SECRETMust match the value set on the web app. Auth fails closed if unset.
DATABASE_URLSupabase Postgres connection string (service-role; bypasses RLS).
OPENAI_API_KEYOptional. Only used when callers request embed_model=openai or for /bridge.
GEMINI_API_KEYOptional. /bridge fallback when OPENAI_API_KEY isn't set — routes through Gemini's OpenAI-compatible endpoint (free tier on AI Studio).
REDUCER_ASYNC_THRESHOLDSet to 999999 here — no Redis on this Space, so all jobs must run inline.

Notes

  • —The all-MiniLM-L6-v2 model is pre-downloaded at image build time, so the first request after a cold start doesn't pay the model download cost.
  • —Inline-only on this Space (no arq worker, no Redis). Datasets above the threshold will time out the HTTP request — small/demo CSVs only.
  • —Source of truth: this directory is mirrored from the `vector-scape` monorepo's services/reducer/.