Healthcare (Hair Transplant Clinics) / BeautyTech AI-Powered Mobile App

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.

"Shipped a clinic-ready hairline simulation app with reliable generations, secure AI calls, and App Store subscriptions"
GenAIImage-InpaintingReplicateFirebaseiOSSubscriptionsTestFlightAppStore
Frontend
iOS (Swift/SwiftUI)Apple TestFlight
Backend
FirebaseCloud Functions
AI Models
Replicate-hosted image inpainting model (hairline enhancement)
Infrastructure
Apple App Store (IAP subscriptions)Replicate API
Lowest
Cost per AI generation
Per-image inference cost using Replicate-hosted model
2 min
High-reliability generation time
Switched to a more stable model variant that "never fails" for production readiness
15%
Reduced platform fee target
Prepared Apple Small Business Program eligibility to lower fees vs. standard 30%

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

Technical Details
Implemented an AI generation pipeline using a Replicate-hosted inpainting model to modify and densify/extend existing hair regions on the user’s real photo rather than overlaying pre-made hairstyles. We tuned the end-to-end experience around third-party inference constraints: handled cold-start boot times (sleep/wake behavior), improved success rates by switching to a slower but more stable model variant (~2 minutes per image) and introduced UX steps to reflect non-linear inference timing. Investigated failure patterns tied to high-key/white backgrounds and advised mitigation through cropping and capture guidance.
Business Value
Clinics can demonstrate realistic, professional "after" expectations during consultations using patient photos, improving trust and reducing decision friction. The app is positioned for B2B monetization (clinic pricing and promo codes) while remaining simple enough for barbershops as a secondary channel.

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.

Replicate APIiOS (Swift/SwiftUI)UX progress state machine

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.

iOS Photo Library APIsImage processing/export pipeline

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.

Firebase Cloud FunctionsiOS state managementReplicate API

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.

Replicate model iterationImage pre-processing (cropping guidance)QA via TestFlight

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.

FirebaseCloud FunctionsApp Store Connect In-App Purchases

Project Timeline

1

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.

2

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.

3

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.

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