Case study 04 / 04

Instax

Semantic photo search over CLIP embeddings with pgvector, plus a written plan for turning the prototype into a product.

Position
Sole developer; prototype and product strategy
Period
August 2026
Stack
  • Python
  • open_clip (CLIP ViT-B/32)
  • PyTorch
  • PostgreSQL
  • pgvector
  • ChromaDB
  • FastAPI
  • Alembic
  • Docker
  • Next.js
Status
Working prototype; code private (see below)
Repo
private (see below)
Datasheet 04 of 04
Instax2026

The problem

Someone standing at a location wants to know what a good photo here looks like and how to take it. That means finding reference images by mood, by an example image, or by place, and not by hashtag.

What works

An end-to-end retrieval loop: CLIP ViT-B/32 embeds every image to a 512-dimension vector; pgvector (HNSW, cosine) stores and searches them; a FastAPI server exposes /search/text, /search/image, and /search/location, with WebP thumbnails generated on the fly. The embedding job is batched in FP16 and resumable. The data layer was migrated from SQLite to Postgres with Alembic migrations.

Retrieval pipeline
text / image CLIP ViT-B/32 512-d pgvector HNSW top-k
CLIP embeds each image to 512 dimensions; pgvector (HNSW, cosine) does the search; three endpoints: text, image, location.

The strategy document

It opens with what is wrong with the prototype: single-node with hardcoded paths; “location search” is a text embedding of a place name with no coordinates behind it; the photo tips are fourteen hardcoded dictionaries; two modules read from different tables; and a 2021 CLIP model cannot tell a golden-hour backlit portrait from a flat midday snapshot, which is the exact distinction the product needs. It then sequences a plan in which each phase removes one of those debts while shipping something visible.

Why the code is private

The reference corpus was scraped from Instagram, which I flagged in the strategy document as a terms-of-service and copyright problem before any commercial use. The architecture treats imagery as a pluggable source so licensed or user-contributed images can replace it. Until that swap happens, the write-up is the artifact and the repository stays private.

More work