Build the schema for each request
The JSON schema changes with gender and service type, so the model cannot return a section the user should not get.
Computer Vision · 2026
A marketplace for barbers and salons, with AI that analyses your face and hair from a selfie and recommends the haircuts and hairstyles that suit you.

The brief
Hairlync is a marketplace where clients find barbers and salons, book appointments and get AI hairstyle recommendations, and where professionals manage their profiles, availability and bookings. The AI is my part of it. You upload a selfie and choose your gender, hair length, occasion and whether you want a haircut, a hairstyle or both. A vision model reads your face and hair and returns a structured analysis with personalised recommendations, scores and styling advice.
The problem
A vision model is flexible, and that is the problem. It sometimes returned hairstyles when the user asked for a haircut, added facial-hair advice for users who should not get it, and cut off long answers into invalid JSON.
What I did
I built the AI analysis from the API to the final output: a FastAPI service that takes the upload, sends it to GPT-4o Vision with a detailed prompt and a response schema built for each request, then validates, filters and enriches what comes back.
The system
Accepts JPG, PNG, WebP and GIF, normalises the user's choices, and scores the photo. A blurry or badly framed photo gets a retake message instead of a poor answer.
GPT-4o Vision reads the selfie against a detailed prompt and a JSON schema built for that gender and service type, with fallback to other models.
Removes sections that do not belong, validates types and scores, drops duplicates, orders the results and limits how many are returned.
Adds a stylist-ready request phrase, salon time and price tier, hair-care advice and matching YouTube tutorials.
Choices
The JSON schema changes with gender and service type, so the model cannot return a section the user should not get.
A photo-quality score runs first. If the photo cannot support a reliable analysis, the user is asked to retake it.
Output is normalised, filtered and validated before anyone sees it, so the product gets reliable data and not generic chatbot text.
Capabilities
Problems
Problem
The model returned hairstyles for a haircut request, or facial-hair advice for users who should not get it.
Fix
I normalised the inputs, built the JSON schema from gender and service type, added explicit prompt rules, and removed invalid sections before returning anything.
Problem
Long answers hit the token limit and came back as invalid JSON.
Fix
I limited the number of recommendations, handled truncated responses explicitly, and validated types and scores.
Stack
AI service (mine)
Platform
The result
Live at hairlync.com. The AI service is covered by 50 automated regression tests.
Next project
JobAssist AI
LLM Application
I work on the AI layer: retrieval, reasoning and the code underneath. I hand it over ready to integrate.