An intelligent, self-hostable AI tool to restore and enhance your photos, built with a robust backend for a smooth and transparent processing experience.
This project is engineered for a superior user experience, giving you more insight and control over the image restoration process.
- Real-Time Processing Status: Track processing progress with status updates and estimated completion times.
- Dual-AI Enhancement Pipeline: Combines the strengths of two powerful AI models: GFPGAN specializes in restoring faces with stunning realism, while Real-ESRGAN upscales and enhances the entire image, including backgrounds.
- User-Centric Interface: A clean and modern UI featuring drag-and-drop, direct URL processing, an interactive before/after comparison slider, and multi-language support (English, 简体中文, 繁體中文, 日本語, 한국어).
- Containerized for Easy Deployment: Includes pre-configured Docker and Docker Compose files for both CPU and GPU environments, ensuring a consistent and reliable setup with a single command.
The recommended way to run this project is with Docker, which handles all dependencies and configuration automatically.
- Git
- Docker & Docker Compose
- A compatible NVIDIA GPU with drivers and the NVIDIA Container Toolkit.(Optional:for GPU acceleration):
Remark: Before starting, make sure Docker is started.
git clone https://github.com/diandiancha/ImageRepair-AI.git
cd ImageRepair-AI
docker-compose -f docker-compose.cpu.yml up --buildAccess the web interface at: http://localhost:5002
git clone https://github.com/diandiancha/ImageRepair-AI.git
cd ImageRepair-AI
docker-compose -f docker-compose.gpu.yml up --buildAccess the web interface at: http://localhost:5001
- NVIDIA GPU: GTX 1060 6GB or better
- VRAM: 6GB+ for optimal performance
- CUDA: Compatible GPU with CUDA 12.1+ support
- RAM: 8GB system memory (16GB recommended for large images)
- Storage: 5GB free space for models and dependencies
This method is for developers who want to run the application outside of Docker.
Remark: This project uses Python 3.10 as the main development environment. The compatibility with other Python versions is unknown. Therefore, if you need to deploy the Python version project yourself, please ensure that the environment is correct.
Step 1: Clone Repository
git clone https://github.com/diandiancha/ImageRepair-AI.git
cd ImageRepair-AI/backendStep 2: Create and Activate Virtual Environment
python -m venv venvOn Windows:
venv\Scripts\activateOn macOS/Linux:
source venv/bin/activateStep 3: Install Dependencies
For CPU-only:
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu
pip install -r backend/requirements.txtFor GPU-acceleration (NVIDIA CUDA 12.1 required):
pip install torch==2.1.2+cu121 torchvision==0.16.2+cu121 torchaudio==2.1.2+cu121 --extra-index-url https://download.pytorch.org/whl/cu121
pip install -r backend/requirements.txtStep 4: Download AI Models
mkdir backend/models
wget -O backend/models/GFPGANv1.4.pth https://github.com/TencentARC/GFPGAN/releases/download/v1.3.0/GFPGANv1.4.pth
wget -O backend/models/RealESRGAN_x4plus.pth https://github.com/xinntao/Real-ESRGAN/releases/download/v0.1.0/RealESRGAN_x4plus.pthStep 5: Run the Application
python backend/app.pyThe application will be available at http://localhost:5000.
🛠️ Technical Details
ImageRepair-AI/
├── backend/
│ ├── app.py # Flask backend with task queue and API
│ ├── Dockerfile.cpu # Docker build definition for CPU
│ ├── Dockerfile.gpu # Docker build definition for GPU
│ └── requirements.txt # Python dependencies
├── assets/
│ └── (comparison images)
├── .gitignore
├── docker-compose.cpu.yml # Docker Compose configuration for CPU
├── docker-compose.gpu.yml # Docker Compose configuration for GPU
├── index.html # Single-page frontend application
├── README.md
└── LICENSE
All endpoints are defined in backend/app.py.
| Endpoint | Method | Description |
|---|---|---|
/api/repair |
POST |
Submits an image (base64 or URL) for restoration. Returns a task_id. |
/api/status/<task_id> |
GET |
Checks the status of a submitted task (pending, processing, completed). |
/api/cancel/<task_id> |
POST |
Requests to cancel a pending or processing task. |
/api/health |
GET |
Provides a health check of the service, including model status and queue size. |
Contributions are welcome! Please follow these steps:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Make your changes
- Test thoroughly
- Submit a pull request
This project is open-source and available under the MIT License.
This project stands on the shoulders of giants. My heartfelt thanks go to the creators of these incredible open-source models:



