test213 / README.md
dkescape's picture
Upload 10 files
0e868b4 verified
---
title: Color Restorization Model
emoji: 🖼️
colorFrom: indigo
colorTo: yellow
sdk: gradio
sdk_version: 3.9
app_file: app.py
pinned: true
license: unlicense
---
# 🌈 Color Restorization Model (CPU Optimized)
Bring your old black & white photos back to life—upload, adjust, and download in vivid color.
This version has been optimized for **CPU inference**, removing GPU dependencies and improving performance on standard hardware.
## Features
* **Adaptive Resolution Processing**: Large images are processed intelligently to preserve sharpness while ensuring fast colorization.
* **Quality Presets**: Choose between **Fast**, **Balanced**, and **High** quality to suit your hardware.
* **Real-time Progress**: Visual progress bar.
* **Pure CPU Stack**: Optimized for Intel/AMD CPUs with AVX2 support (via PyTorch).
## CPU Compatibility Matrix
| Processor Generation | Recommended Preset | 1080p Processing Time (Est.) |
| :--- | :--- | :--- |
| Intel Core i3 / Older | **Fast (256px)** | 2-5s |
| Intel Core i5 (8th Gen+) | **Balanced (512px)** | 1-3s |
| Intel Core i7 / Ryzen 7 | **High (1080px)** | 3-8s |
| M1/M2 Mac | **Balanced** | <1s |
## Performance Tuning
* **Memory Constrained (<8GB RAM):** Stick to "Fast" or "Balanced".
* **High-Res Archival:** Use "Original" resolution only if you have >16GB RAM and patience.
* **Batch Processing:** The core logic is thread-safe and can be extended for batch processing.
## Technical Details
The application uses the DDColor architecture via ModelScope. Optimizations include:
1. **L-Channel Preservation:** We apply colorization at a lower resolution and merge it with the original high-resolution Luminance channel using LAB color space.
2. **In-Memory Pipeline:** Removed disk I/O bottlenecks.
3. **Dynamic Quantization:** Automatically applied to the model on supported CPUs.
## Installation
```bash
pip install -r requirements.txt
python app.py
```
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference