This application allows users to upload interior images, select objects (walls, furniture) via AI-assisted segmentation (SAM), and recolor them realistically using LAB color space blending.
- Python 3.8+
- CUDA-capable GPU (Recommended) or CPU
-
Clone/Open Project Directory
cd "Python Image with color"
-
Install Dependencies
pip install -r requirements.txt
-
Download Model Weights If the
weights/folder is empty, run:python download_weights.py
This downloads the
sam_vit_b_01ec64.pthcheckpoint.
Run the Streamlit app:
streamlit run app.py- Upload: Drag and drop an interior image (JPG/PNG).
- Wait: The system will compute embeddings (takes ~5-10s on CPU initially).
- Select: Click on the object you want to recolor on the image.
- Recolor: Pick a color from the sidebar and click "Apply Color".
- Iterate: Use "Undo" to revert changes.
- Download: Click "Download Image" to save your result.
- Frontend: Streamlit
- AI Model: Segment Anything Model (ViT-B)
- Color Engine: OpenCV (LAB Color Space)
This project includes configuration for deploying to Render.
- Push this code to a GitHub or GitLab repository.
- Log in to Render and click New + -> Web Service.
- Connect your repository.
- Render should automatically detect the
render.yamlfile.- If manually configuring:
- Runtime: Python 3
- Build Command:
./build.sh - Start Command:
streamlit run app.py --server.port $PORT --server.address 0.0.0.0
- If manually configuring:
- Important: Select the Starter plan or higher. The AI model requires significant RAM and may crash on the Free tier.