Transform faces with AI-powered morphing using your custom LoRA models with cloud GPU processing or local ComfyUI workflow.
- Simple Web Interface: Drag & drop image upload with user authentication
- Three Transformation Levels:
- π’ HTN (30% denoise) - Minimal Enhancement
- π΅ Chadlite (35% denoise) - Strong Transform
- π Chad (40% denoise) - Extreme Power
- Cloud GPU Processing: RunPod Stable Diffusion XL serverless integration
- Local Processing: ComfyUI with FaceDetailer for precise face detection
- User System: Authentication, credits, and payment processing
- Credit System: Free tier (1 generation/day) + paid tier (100 credits/$5)
- Payment Options: Crypto and bank transfers (Kyrgyzstan-compatible)
- Automated Workflow: No manual Photoshop work needed
- Real-time Progress: Live status updates during processing
- Easy Download: One-click result download
Option A: Cloud GPU (RunPod) - Recommended βοΈ
- No local GPU required
- Faster processing with professional GPUs
- Pay-per-use pricing
- See RunPod Setup below
Option B: Local ComfyUI π»
- Use your own GPU
- Full control over models and workflows
- One-time setup cost
- See Local Setup below
- Python 3.8+: Required for the web app
- Database: PostgreSQL (recommended) or SQLite for development
- Either:
- RunPod Account: For cloud GPU processing
- ComfyUI + GPU: For local processing
π New: The app now supports both cloud GPU (RunPod) and local ComfyUI processing!
π° Cost Savings: Switch to RunPod serverless endpoints to reduce costs by over 80% compared to dedicated pods. See RUNPOD_SERVERLESS_SETUP.md for migration instructions.
- Sign up at RunPod.io and add credits
- Create a new Serverless Endpoint:
- Template: "Stable Diffusion XL"
- GPU: RTX 4090 or A100
- Name:
face-morphing-sdxl
- Upload your LoRA to a public URL (Hugging Face, Google Drive, etc.)
- Copy your API key and Endpoint ID
# Copy the RunPod example configuration
cp .env.runpod.example .env
# Edit .env with your RunPod details:
USE_CLOUD_GPU=true
RUNPOD_API_KEY=your_api_key_here
RUNPOD_ENDPOINT_ID=your_endpoint_id_here
RUNPOD_LORA_URL=https://your-lora-url.com/chad_sd1.5.safetensors# Install Python dependencies
pip install -r requirements.txt
# Test RunPod connection
python test_runpod.py
# Run the app
python app.pyπ Detailed Guide: See RUNPOD_SETUP.md for complete setup instructions.
-
Navigate to your ComfyUI directory
-
Start ComfyUI with API enabled:
python main.py --listen 127.0.0.1 --port 8188
Or if you want network access:
python main.py --listen 0.0.0.0 --port 8188
-
Verify ComfyUI is running by visiting: http://127.0.0.1:8188
# Install Python dependencies
pip install -r requirements.txt-
Copy your models to ComfyUI directories:
ComfyUI/models/checkpoints/real-dream-15.safetensors ComfyUI/models/loras/chad_sd1.5.safetensors -
Or update the workflow.json to point to your model locations
# Create environment file
cp .env.example .env
# Edit .env:
USE_CLOUD_GPU=false
COMFYUI_URL=http://127.0.0.1:8188python app.pyThe app will start on: http://localhost:5000
Morph-app/
βββ app.py # Main Flask application
βββ config.py # Configuration settings
βββ models.py # Database models (User, Generation, etc.)
βββ auth.py # Authentication routes
βββ payments.py # Payment processing
βββ runpod_client.py # RunPod API client
βββ comfyui_client.py # ComfyUI API client
βββ requirements.txt # Python dependencies
βββ .env.runpod.example # RunPod configuration example
βββ test_runpod.py # RunPod integration test
βββ templates/
β βββ landing.html # Landing page
β βββ index.html # Main app interface
β βββ dashboard.html # User dashboard
β βββ login.html # Login page
β βββ register.html # Registration page
βββ comfyui_workflows/
β βββ workflow_*.json # ComfyUI workflows
βββ uploads/ # Temporary uploaded images
βββ outputs/ # Generated results
βββ deployment/ # Deployment configurations
βββ RUNPOD_SETUP.md # RunPod setup guide
βββ FACEDETAILER_SETUP.md # FaceDetailer setup guide
The app supports multiple AI processing workflows:
- Superior Quality: Advanced face detection with YOLO + SAM
- Natural Results: Better integration with surrounding areas
- Precise Masking: Pixel-perfect face boundaries
- Setup: See
FACEDETAILER_SETUP.mdfor installation
- Fast Processing: Quick face swapping
- Simple Setup: Minimal dependencies
- Reliable: Proven workflow for basic transformations
- Default: Works out of the box
Edit config.py to change the active workflow:
CURRENT_WORKFLOW = 'facedetailer' # or 'reactor'Edit app.py to change ComfyUI URL:
COMFYUI_URL = 'http://127.0.0.1:8188' # Change if neededThe three transformation levels are defined in app.py:
PRESETS = {
'HTN': {'denoise': 0.30, 'name': 'HTN', 'description': 'Subtle Enhancement'},
'Chadlite': {'denoise': 0.35, 'name': 'Chadlite', 'description': 'Moderate Transform'},
'Chad': {'denoise': 0.40, 'name': 'Chad', 'description': 'Maximum Power'}
}Modify in app.py:
app.config['MAX_CONTENT_LENGTH'] = 16 * 1024 * 1024 # 16MB max- Check if ComfyUI is running: Visit http://127.0.0.1:8188
- Verify API is enabled: ComfyUI should show "API server running"
- Check firewall: Make sure port 8188 is not blocked
- Verify model paths in your
workflow.json - Check model files exist in ComfyUI directories
- Ensure LoRA file
chad_sd1.5.safetensorsis accessible
- Check file format: Only PNG, JPG, JPEG, WebP supported
- File size limit: Maximum 16MB per image
- Image dimensions: Maximum 2048x2048 pixels
Change the Flask host in app.py:
app.run(debug=False, host='0.0.0.0', port=5000)The app is ready for cloud deployment on:
- Railway: Add
railway.tomlconfiguration - Render: Works with current
requirements.txt - AWS/GCP: Use Docker or direct deployment
- Heroku: Add
Procfilefor web process
Create Dockerfile:
FROM python:3.9-slim
WORKDIR /app
COPY requirements.txt .
RUN pip install -r requirements.txt
COPY . .
EXPOSE 5000
CMD ["python", "app.py"]- File uploads are validated for type and size
- Temporary files are cleaned up automatically
- No user data is permanently stored
- Consider adding authentication for production use
- Best Results: Use clear, well-lit face photos
- Image Quality: Higher resolution input = better output
- Face Position: Centered faces work best
- Lighting: Even lighting produces more consistent results
GET /- Landing page or dashboard (if authenticated)GET /health- Health check and GPU statusPOST /auth/login- User loginPOST /auth/register- User registrationGET /auth/logout- User logout
GET /dashboard- User dashboard with stats and creditsGET /app- Main app interfacePOST /upload- Upload image filePOST /process- Start processing workflow (RunPod or ComfyUI)GET /status/<prompt_id>- Check processing statusGET /result/<prompt_id>- Download resultGET /auth/profile- User profile page
POST /payments/crypto- Process crypto paymentPOST /payments/bank- Process bank transferGET /payments/status/<transaction_id>- Check payment status
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
This project is open source. Feel free to modify and distribute.
If you encounter issues:
- Check the troubleshooting section above
- Verify your ComfyUI setup is working
- Check the browser console for JavaScript errors
- Review the Flask logs for server errors
Made with β€οΈ for the AI community