Projects & Experience

2026

Face Swap Studio

A local macOS app for mapping source faces to faces in selected photos and running batch face swaps. It brings together pluggable models, face detection, previews, post-processing and result export; it does not process video.

Project roles
macOS Application DeveloperPython DeveloperML Model Integration EngineerUI Developer

Technologies and tools

Python 3.11FastAPIUvicornPyWebViewHTMLCSSJavaScriptGradio (archived UI prototype)NumPyOpenCVPillowONNXONNX RuntimeCoreML Execution ProviderCPU Execution ProviderInsightFacePyTorchTorchvisionMPSSciPyscikit-imageBasicSRGFPGANFaceXLibReal-ESRGANHugging Face HubRequestsgdownPyYAMLpsutilpytestpytest-covRuffmypyBashSHA-256Apple SiliconmacOS `.app` packagingRussian and English documentation
  • Built a local macOS photo-processing app that combines multiple source faces and target images in one workflow. Users map source faces to faces in target photos and generate results sequentially for selected images. The app does not implement video processing.
  • Registered nine pluggable models: InSwapper 128, HyperSwap 1A 256, HyperSwap 1B 256, UniFace 256, SimSwap 512 Beta, GHOST U-Net with 1, 2 and 3 blocks, and GHOST 2.0 Head Swap. The first four ONNX models run through the main runtime; SimSwap and the GHOST families use separate runner processes in prepared Python environments. A model is marked available only when its weights, environment and runner are present. Third-party model architectures and weights were not trained or created in this project.
  • Implemented face detection with InsightFace `buffalo_l`: 640×640 detector input, a configurable confidence threshold from 0.1 to 0.95 (0.5 by default), left-to-right ordering and a limit of 100 faces per image. The interface displays numbered detection boxes and separate face thumbnails.
  • Added multi-image upload for PNG, JPG/JPEG, WebP and BMP, removal of uploaded files, and selection of target photos for batch processing. Source and target faces are grouped by photo; users can open a larger preview and inspect detected regions.
  • Built visual mapping from each target face to a source face: assign a source per face, apply one source to selected faces in bulk, or keep a face unchanged. Each target face is processed as a crop, then composited back into the original photo with a feathered mask so the rest of the image is preserved.
  • Added selection of one model for a batch run and sequential processing of selected target photos, with a separate result for each image. The interface shows model availability, operation progress, errors and notifications; results can be browsed in a gallery, opened in a larger preview and removed from the current session.
  • Integrated post-processing with GFPGAN v1.4 and Real-ESRGAN x4plus. Face-restoration strength is adjustable from 0 to 1 (0.35 by default); image upscaling supports factors from 1× to 4× and tile sizes from 64 to 1024 pixels. Output images are limited to a maximum side of 8,000 pixels.
  • Implemented PNG output, single-result downloads and ZIP archives of selected results. Files downloaded by the user remain in the Downloads folder and are not removed with the app's temporary data.
  • Built the app around a local FastAPI/Uvicorn backend at `127.0.0.1:7860` and a custom HTML, CSS and JavaScript interface. PyWebView starts the backend, waits for its health check and opens a native macOS window; the interface can also be opened in a browser. Added light and dark themes, backend and model status, session reset and processing-stage feedback.
  • Kept uploaded images, crops, analysis data, intermediate files and results in temporary session storage, cleared when the app closes and on the next launch. Processing and API access remain local; the server is not exposed to the network. ONNX uses the CoreML Execution Provider with CPU fallback; PyTorch uses MPS on Apple Silicon with CPU fallback.
  • Separately adapted the CUDA-oriented code in the external SimSwap and GHOST runners for Mac: a compatibility layer redirects `.cuda()` calls and `cuda` device arguments in `.to()` to MPS when available, or to CPU; it also normalizes tensor creation, checkpoint loading and autocast. ONNX Runtime CUDA-provider requests are handled and available providers are selected. CUDA itself does not run on Mac; the adaptation is in the integrated models' code, and some safe execution paths use CPU.
  • Prepared scripts to create SimSwap/GHOST environments, download and verify model files, check system dependencies, start and stop the app, and package a macOS `.app` with its required resources. The repository includes smoke scripts for external runners and pytest checks for image exchange, adapter registration and empty detection results. These validate integration scaffolding, not face-swap quality benchmarks. Added Russian and English documentation covering setup, models, processing, limitations and local data storage.