Spaces:
Paused
Paused
|
Download SETUP.md from TechAvenger/ClothIron: direct link, hf CLI and curl.
- Browser
- Download file 2.89 kB
-
https://huggingface.co/spaces/TechAvenger/ClothIron/resolve/main/SETUP.md
- Command line
-
hf download hf://spaces/TechAvenger/ClothIron/SETUP.md
-
curl -L -o SETUP.md https://huggingface.co/spaces/TechAvenger/ClothIron/resolve/main/SETUP.md
2.89 kB
A newer version of the Gradio SDK is available: 6.32.0
Setup & Run Guide
1. PyCharm Setup
Clone / open project
- Open PyCharm β File β Open β select the
garment_ironing/folder - PyCharm will detect
requirements.txtautomatically
Create virtual environment
In PyCharm terminal:
python -m venv venv
# Windows
venv\Scripts\activate
# macOS / Linux
source venv/bin/activate
pip install --upgrade pip
pip install -r requirements.txt
Run configuration
- Run β Edit Configurations β + β Python
- Script:
app.py - Working directory: project root
- Click Run or press Shift+F10
The app opens at http://localhost:7860
2. Generate example images (first run only)
python create_example_assets.py
3. Train custom wrinkle model (optional)
# Prepare your dataset in data/train/images, data/train/masks, data/val/...
python train_wrinkle_model.py --data_dir data --epochs 50 --batch_size 8
4. Publish to HuggingFace Spaces
Install HF CLI
pip install huggingface_hub
huggingface-cli login # paste your HF token
Create a new Space
huggingface-cli repo create garment-ironing --type space --space_sdk gradio
Push all files
cd garment_ironing
git init
git add .
git commit -m "initial commit"
git remote add origin https://huggingface.co/spaces/YOUR_USERNAME/garment-ironing
git push -u origin main
HuggingFace will automatically install requirements.txt and run app.py.
5. Environment variables (optional secrets)
If you want to use private HF model weights, set in HF Space secrets:
HF_TOKENβ your HuggingFace token
6. GPU vs CPU behaviour
| Hardware | Ironing method | Speed |
|---|---|---|
| NVIDIA GPU (β₯8 GB VRAM) | Stable Diffusion inpainting | ~10β30 s/image |
| CPU only | Classical bilateral + guided filter | ~3β8 s/image |
HuggingFace Spaces free tier runs on CPU. Upgrade to a GPU Space for SD inpainting.
7. File structure
garment_ironing/
βββ app.py β Gradio UI + entry point
βββ requirements.txt
βββ README.md β HuggingFace Spaces config + docs
βββ train_wrinkle_model.py β Training script (run locally)
βββ create_example_assets.py β Generate placeholder example images
βββ assets/ β Example images for the UI
βββ models/
β βββ __init__.py
β βββ segmentation.py β SegFormer garment segmenter
β βββ wrinkle_detector.py β Multi-scale wrinkle detection
β βββ ironing_pipeline.py β Classical + SD inpainting ironer
βββ utils/
βββ __init__.py
βββ image_utils.py β Resize, compare, overlay helpers
βββ analysis.py β Wrinkle scoring + report generation