How s0md3v/roop works
This archived Stable Diffusion WebUI extension replaces selected target faces with a face from a user-supplied image. The main workflow runs through the WebUI script hooks into the swap engine, which checks target safety, detects faces, applies a selected model, and optionally restores or upscales the result. A separate API exposes image swapping and model listing. The README documents the WebUI workflow and safety behavior; sampled source shows the principal calls, but not every host callback detail.
Main entry points: swapper.py Swap engine · faceswap.py WebUI script · api.py Roop API · roop_logging.py Logger
Components 13
WebUI integration
- WebUI script
scripts/faceswap.py - Model catalog
scripts/faceswap.py
Face replacement
- Swap engine
scripts/swapper.py - NSFW check
scripts/cimage.py - Face detection
scripts/swapper.py - Face-swap model
scripts/swapper.py - Image enhancement
scripts/swapper.py
API integration
- Roop API
scripts/api.py
Runtime support
- Logger
scripts/roop_logging.py - Version display
scripts/roop_version.py
Other components
- WebUI user
- Stable Diffusion WebUI
- API client
Connections 15
- WebUI user → WebUI script: configures
README.md - Stable Diffusion WebUI → WebUI script: runs hooks
README.md - WebUI script → Swap engine: swaps faces
scripts/faceswap.py - WebUI script → Model catalog: lists models
scripts/faceswap.py - Swap engine → NSFW check: checks image
scripts/swapper.py - Swap engine → Face detection: detects faces
scripts/swapper.py - Swap engine → Face-swap model: loads and applies
scripts/swapper.py - Swap engine → Image enhancement: enhances result
scripts/swapper.py - Swap engine → Logger: logs events
scripts/swapper.py - WebUI script → Logger: logs events
scripts/faceswap.py - API client → Roop API: requests swap
scripts/api.py - Roop API → Model catalog: lists models
scripts/api.py - Roop API → Swap engine: swaps faces
scripts/api.py - Roop API → Stable Diffusion WebUI: registers callback
scripts/api.py - Version display → Logger: logs version
scripts/roop_version.py