Hairfit: Project Story

Inspiration

We’ve all had that moment: “Would that celebrity’s hairstyle look good on me?” But answering it usually means spending $200, 3 hours, and hoping for the best.

We wanted trying a hairstyle to feel as instant and reversible as trying on clothes online. That spark became Hairfit.


What It Does

Upload your photo → search any celebrity → click their hairstyle → get 8 AI variations of you wearing that exact look in seconds.

Choose your favorite, and the system adapts—each user choice feeds a learning loop, improving future generations.


How We Built It

  • Next.js + React for the interface
  • Google Gemini 2.5 Flash Image for hairstyle transfer
  • Supabase for logs, strategy scoring, and evolution
  • A self-evolving pipeline where 8 prompt strategies compete, users select winners, and scores update automatically with an ELO-style formula:

[ \text{new_score} = \text{old_score} + K (R_{\text{actual}} - R_{\text{expected}}) ]

This natural-selection system improves the model’s performance over time.


Challenges

  • Gemini resisted dramatic changes—kept giving subtle edits
  • Hardcoded prompts weren’t obeying reference photos
  • CORS blocked file downloads on web
  • Designing an evolution engine with dynamic prompts, scoring, and parallel generations was non-trivial

We solved these by simplifying prompts, consolidating logic server-side, and restructuring how generators were orchestrated.


Accomplishments We’re Proud Of

  • Built a real self-evolving AI that learns from every user choice
  • Achieved real-time streaming of 8 parallel generations
  • Designed a database-driven natural-selection system for prompt evolution
  • Created an intuitive, creator-friendly experience with instant visual feedback

What We Learned

  • Simple prompts outperform complex ones
  • Real user feedback > theoretical evaluation metrics
  • Evolution systems require careful early architecture
  • Streaming keeps users engaged and reduces perceived latency
  • Competition between strategies creates organic optimization

What’s Next for Hairfit

  • Add more AI models competing simultaneously
  • Fine-tune appearance transfer on anonymized user data
  • Launch mobile apps (iOS + Android)
  • Partner with salons for “preview before you cut”
  • Add social features and community-driven challenges
  • Explore genetic algorithms for smarter prompt mutation and evolution
Share this project:

Updates