Natural Hairline Simulations From Real Photos for Hair Transplant Consultations
An AI-powered iOS app that generates natural-looking, post-transplant hairline simulations from patient photos—optimized for clinic workflows, secure access, and subscription monetization.
Problem Statement
The client needed an AI tool that could enhance existing hair realistically (not swap in generic hairstyles) to simulate post-transant outcomes from real photos. Early builds suffered from long and unpredictable generation times due to cold starts, progress UI that repeatedly reset, image save quality loss, edge-case failures with white backgrounds, and instability during backgrounding—putting App Store launch and clinic demos at risk.
Our Approach
We engineered an iOS workflow for patient photo capture/upload, hairline modification via AI inpainting, and a results pipeline that saves full-quality outputs. The app routes generation requests through Firebase Cloud Functions to protect Replicate credentials and enforce subscription status. We iterated on UX reliability (step-based progress, crash/loop mitigation), added TestFlight-based QA with external testers, and finalized App Store readiness with subscriptions and required compliance items (privacy policy/TOS/EULA guidance).
Photo-Real Hairline Enhancement via Targeted Inpainting
Challenges We Solved
Unpredictable Generation Wait Times from Server Cold Starts
Users experienced 2–10 minute waits and a progress bar that repeatedly hit 100% and restarted, especially when the model instance was sleeping on the provider side—hurting clinic demos and risking negative reviews.
Redesigned the loading UI into explicit multi-step stages (iterated from 3 to 5 steps) to avoid false completion signals and align expectations with variable inference timing. Documented and communicated Replicate sleep/boot mechanics to stakeholders, and recommended paths to eliminate cold starts (reserved GPU server) when revenue/investment allows.
Pixelated Saves vs. Clean Screenshots (Output Quality Mismatch)
Generated images appeared acceptable on-screen and via screenshots, but saved-to-gallery results were pixelated—blocking clinical usage where high-quality exports are required.
Adjusted the image export pipeline to persist the original generation output at full fidelity instead of a downscaled UI-rendered snapshot, restoring professional-quality saves for patient sharing and records.
Generation Looping, Duplicate Saves, and Temporary Provider Ban
A flow using in-app camera capture caused very long generations, then UI looping on the result screen and saving the same generated image multiple times. The user later could not generate, consistent with throttling/banning behavior after repeated calls.
Mitigated client-side looping/duplicate-save behavior by stabilizing state transitions around the generation lifecycle and reducing accidental repeated submission. Added Cloud Functions groundwork to enforce access rules and reduce direct client exposure that can lead to abuse patterns.
White-Background Failure Cases in Inpainting
The model produced poor or failing results when subject photos had white backgrounds—likely due to mask/background ambiguity in inpainting (white-on-white).
Reproduced the issue from shared sample images, added operator guidance (crop tighter / prefer in-app camera capture) and continued model investigation; selected a more robust model variant to reduce failure frequency in production.
Securing AI Credentials and Enforcing Subscriptions
Direct mobile-to-AI-provider calls risked API key exposure and made it difficult to prevent usage after subscription expiry.
Moved sensitive requests behind Firebase Cloud Functions, enabling server-side key protection and subscription-gated access control. Coordinated App Store Connect paid agreements and IAP setup for subscription rollout plus promo-code strategy for clinics/barbers.
Project Timeline
Discovery
Defined core use case: realistic hairline modification on real photos for post-transplant simulation (not hairstyle swapping). Aligned on go-to-market focus (clinics first), pricing concepts, and promo-code strategy for free first month.
Build
Iterated through TestFlight releases, added external testers, improved reliability and UX (multi-step progress, background-safe generation), fixed output export quality, investigated white-background failures, and introduced secure server-side mediation via Firebase Cloud Functions. Implemented subscription mechanism and prepared App Store financial agreements.
Launch
Completed App Store readiness (subscriptions, compliance prerequisites guidance, promo approach) and shipped a production build accepted and published on the App Store, with the first maintenance month included post-launch.
Screenshots & Visuals
Want results like this for your business?
No pressure, no pitch deck. Just a free strategy call to explore what’s possible for your specific goals — and whether we’re the right fit to get you there.
Book a Free Strategy Call