Problem
Profi.ru wanted more search traffic to its service pages. People searching for inspiration use specific phrases such as "velvet manicure" or "French manicure", so the team built photo-gallery pages per service from specialists' work photos. The first version filled each page with random photos of the topic. Traffic grew, then fell sharply, the bounce rate reached 60%, and search engines lowered the pages in the results. Selecting photos by hand from tens of millions was not realistic, and only 30% of photos had a specialist's caption.
Example from the article: a page for "velvet manicure" showed random nail photos instead of velvet ones.
Solution in brief
Compute one embedding per photo and one per service name with a pretrained CLIP-family model, both in the same vector space. Store photo vectors in PostgreSQL with pgvector. For each service name, find the nearest photo vectors by cosine similarity through an HNSW index and save the selection, which the front end loads ready-made.
Questions this case answers
- How to select, from tens of millions of uncaptioned images, the ones that match a free-text topic when keyword matching on noisy or missing captions fails
- How to retrieve images for a text query with a pretrained joint text-image embedding model and a vector index, without training and without a separate captioning step
- How to fill SEO image-gallery pages with photos that match long-tail queries such as 'velvet manicure' or 'beige French manicure'?
- How to match tens of millions of user-uploaded photos to service names when only 30% of photos have captions?
Tools and methods
- CLIP (Xenova/clip-vit-base-patch16) — joint image and English-text embeddings, run in TypeScript through Transformers.js
- pgvector on PostgreSQL — storing photo vectors and searching them
- HNSW index — fast nearest-neighbor search over the vectors
- Cosine similarity — scores how well a photo matches a service name
Google or a one-time email code. No password.