--- title: FaceSpace Studio emoji: 🌖 colorFrom: red colorTo: gray sdk: gradio sdk_version: 5.35.0 app_file: app.py pinned: false --- # 🌖 FaceSpace Studio **AI face replacement using the latest models and optimizations** ## ✨ Features - **🚀 Latest AI Stack**: PyTorch 2.7.1 + Gradio 5.35.0 + Diffusers 0.31.0 - **🧠 Advanced Models**: InsightFace Buffalo_L + Stable Diffusion v1.5 + DPM++ Scheduler - **⚡ GPU Optimizations**: XFormers + Memory Management - **🎨 Professional Blending**: Poisson Seamless Cloning + Alpha Blending - **📹 Video Processing**: FFmpeg + Frame-by-frame replacement - **🔒 Security**: Input validation + Memory limits ## 🔬 Technical Specifications ### Core Dependencies - **PyTorch**: 2.7.1 (Latest stable) - **Gradio**: 5.35.0 (Server-side rendering) - **Diffusers**: 0.31.0 (Latest model optimizations) - **Transformers**: 4.45.0 (Performance improvements) - **OpenCV**: 4.10.0.84 (Latest computer vision) - **InsightFace**: 0.7.3 (Face detection) - **XFormers**: 0.0.28.post1 (Memory-efficient attention) ### AI Pipeline 1. **Face Detection**: InsightFace Buffalo_L 2. **Enhancement**: Stable Diffusion v1.5 with DPM++ scheduler 3. **Blending**: Poisson seamless cloning or alpha blending 4. **Optimization**: GPU acceleration with memory management ## 🚀 Usage ### Image Processing 1. Upload target image and reference face 2. Adjust enhancement prompt and settings 3. Select blend method (Poisson recommended) 4. Process with AI optimizations ### Video Processing 1. Upload video (up to 120 frames supported) 2. Provide reference face image 3. Configure processing parameters 4. Generate enhanced video ## ⚙️ Advanced Settings - **Transformation Strength**: 0.2-1.0 (higher = more dramatic) - **Guidance Scale**: 1.0-20.0 (higher = stronger prompt following) - **Quality Steps**: 15-50 (more steps = better quality) - **Blend Method**: Poisson (seamless) or Alpha (soft) ## 💡 Tips for Best Results 1. **High-Quality Images**: Use well-lit, high-resolution photos 2. **Clear Face Visibility**: Front-facing angles work best 3. **Prompt Engineering**: Detailed prompts improve results 4. **Poisson Blending**: Use for seamless integration ## 🎯 Recommended Hardware - **CPU**: 8+ cores, 16GB+ RAM - **GPU**: NVIDIA T4 (16GB VRAM) or better - **Storage**: 20GB+ for models and cache Built with 2025 technology stack Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference