Lip Restyling with AI: a Demo and Research on Geometric, 3D and Generative Methods
A lip-style preview demo for beauty clinics; behind it, wide experiments with MediaPipe, geometric warping, a 3D face, Stable Diffusion XL, Flux and RunPod.
Overview
A demo web app to preview the shape of lips for beauty clinics. The client gives a photo of herself or himself, picks one of several lip styles (Doll, Heart, Hollywood, Natural and Russian) and in a few seconds sees how the lips would look in that style, next to the original photo. The aim is that the doctor and the client reach a shared picture of the result before any injection. The demo runs at lip.alipour.me and you can try it. I built this project in 2026.
The pictures on this page were taken from the demo itself, with its sample photos.
The demo website
Ready samples: five sample faces and five lip styles. When you pick a face and a style, the result shows next to the original photo, so a visitor can see the quality without uploading a photo.
Custom engine: you upload your own photo, pick a style, and watch the process live (the work runs in the background and the page follows its status).
Design: dark and clean, with a preview of the lips of each style on the selection button, and friendly to mobile.
The work behind it
The main part of this project was research and experiments: how can the shape of lips be changed on a real photo in a natural and believable way? I built and tested several very different ways, and compared the results of all of them.
Studying lip aesthetics. I read medical papers and filler injection guides and turned their rules into numbers: the ratio of the upper to the lower lip (about 1 to 2), the ratio of the mouth width to the nose width (about 1.6 times), the shape of the cupid's bow and the philtrum, and the fact that too much increase looks artificial. These rules became my yardstick for judging the results.
Finding the lips with face landmarks. With MediaPipe and the 468 face landmarks, I found the exact border of the lips and the corners of the mouth, and made a lip mask from them, which was the base of all later methods.
Geometric methods (no generative AI). Changing the shape of the lips by moving points: a bulge distortion, a liquid magnifier, mesh-based warping (Piecewise Affine) and Thin Plate Spline, with interactive tools with sliders for strength, size, edge softness and colour saturation. I also wrote the movement of the lip points by style (the length and the centre of the lip). The result was fast and controllable, but limited for really adding volume, texture and colour to the lips.
3D face reconstruction. With a 3D morphable face model I built a 3D face so that the lips could be changed in 3D and put back on the photo, along with experiments with reflection maps and perspective.
Generative (diffusion) models and inpainting. I mask the lip area and the model rebuilds only that area. I tried several model families: Stable Diffusion XL with its inpainting version, SDXL Turbo for speed, several models tuned for faces (like Juggernaut and DreamShaper), LoRAs to tune the style, Stable Diffusion 3 with a fast model, and Flux (FLUX.2) with ComfyUI and inpainting graphs. Also ready-made tools such as Fooocus and HD-Painter. I wrote prompts for every style, for example "Russian technique with 1 cc of filler, natural colour, no lipstick".
Running the models on a remote GPU. I ran the heavy models on RunPod (with Docker, custom containers and a serverless endpoint) and wrote tools to install and download the models.
The diagram below shows the overall path.
What I learned from the comparison
Geometric methods are fast and controllable, but do not create new texture or colour.
Generative models give the most natural result, but you need an exact mask and a good prompt or the face of the whole photo changes. The quality, cost and run time of the models also differ.
For a demo, running on a managed cloud service is simpler and steadier than keeping a GPU, so the website uses a remote image-generation service, and I used the results of my experiments to choose and tune it.
Technical details of the website
Next.js, React, TypeScript and Tailwind CSS.
MediaPipe Tasks Vision to find the face.
A server-side API route to send the request and ask for the status of the job until the result is ready, so the key of the service stays on the server only.
The samples are pre-made so the demo opens instantly.
Tools
Python, OpenCV, MediaPipe, PyTorch, Diffusers, Gradio
Stable Diffusion XL, SDXL Turbo, Stable Diffusion 3, Flux, LoRA, ComfyUI, Fooocus
A 3D face model, Thin Plate Spline, Piecewise Affine
RunPod, Docker, Next.js, TypeScript
Result
A demo that shows a preview of the shape of the lips in a few seconds, and behind it a wide study and set of experiments with geometric, 3D and generative methods to reach a natural result.
Gallery
BLOG
Related posts
Questions about this project?
If you have questions about this project, or a similar one in mind, I would be glad to hear from you.