Spaces:
Runtime error
Runtime error
feat(deploy): configure project for HF Spaces T4 GPU
Browse files- Add --extra-index-url for pre-built CUDA llama-cpp-python wheel
- Add datasets as runtime dependency
- Create packages.txt with system build deps (cmake, build-essential)
- Rewrite README.md for hackathon submission (bonus quests, usage, arch)
- Add hardware: t4-small to Space front matter
- Gitignore data/samples/ (generated at runtime via Obtener Dataset)
Co-authored-by: Cursor <cursoragent@cursor.com>
- .gitignore +1 -0
- README.md +84 -34
- packages.txt +2 -0
- requirements.txt +2 -0
.gitignore
CHANGED
|
@@ -4,5 +4,6 @@ __pycache__/
|
|
| 4 |
*.pyc
|
| 5 |
data/catalog.json
|
| 6 |
data/garments/
|
|
|
|
| 7 |
.env
|
| 8 |
docs/
|
|
|
|
| 4 |
*.pyc
|
| 5 |
data/catalog.json
|
| 6 |
data/garments/
|
| 7 |
+
data/samples/
|
| 8 |
.env
|
| 9 |
docs/
|
README.md
CHANGED
|
@@ -1,63 +1,113 @@
|
|
| 1 |
---
|
| 2 |
title: Wardrobe Us
|
| 3 |
-
emoji:
|
| 4 |
colorFrom: green
|
| 5 |
colorTo: blue
|
| 6 |
sdk: gradio
|
| 7 |
sdk_version: 6.17.3
|
| 8 |
-
python_version:
|
| 9 |
app_file: app.py
|
| 10 |
pinned: false
|
| 11 |
-
license:
|
| 12 |
-
|
|
|
|
| 13 |
---
|
| 14 |
|
| 15 |
-
# π Wardrobe
|
| 16 |
|
| 17 |
-
|
| 18 |
|
| 19 |
-
|
| 20 |
|
| 21 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
|
| 23 |
---
|
| 24 |
|
| 25 |
-
##
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
|
| 27 |
-
|
| 28 |
|
| 29 |
-
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
- Don't remember care instructions
|
| 33 |
-
- Have difficulty organizing clothes by season
|
| 34 |
|
| 35 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
|
| 37 |
---
|
| 38 |
|
| 39 |
-
##
|
| 40 |
|
| 41 |
-
###
|
| 42 |
|
| 43 |
-
|
|
|
|
|
|
|
|
|
|
| 44 |
|
| 45 |
-
|
| 46 |
-
- Videos
|
| 47 |
|
| 48 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 49 |
|
| 50 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 51 |
|
| 52 |
-
|
| 53 |
|
| 54 |
-
|
| 55 |
-
{
|
| 56 |
-
"type": "shirt",
|
| 57 |
-
"color": "blue",
|
| 58 |
-
"material": "cotton",
|
| 59 |
-
"brand": "Levi's",
|
| 60 |
-
"season": "spring",
|
| 61 |
-
"style": "casual"
|
| 62 |
-
}
|
| 63 |
-
```
|
|
|
|
| 1 |
---
|
| 2 |
title: Wardrobe Us
|
| 3 |
+
emoji: π
|
| 4 |
colorFrom: green
|
| 5 |
colorTo: blue
|
| 6 |
sdk: gradio
|
| 7 |
sdk_version: 6.17.3
|
| 8 |
+
python_version: "3.13"
|
| 9 |
app_file: app.py
|
| 10 |
pinned: false
|
| 11 |
+
license: mit
|
| 12 |
+
hardware: t4-small
|
| 13 |
+
short_description: AI wardrobe assistant - catalog, combine and ask about your clothes
|
| 14 |
---
|
| 15 |
|
| 16 |
+
# π Wardrobe Us
|
| 17 |
|
| 18 |
+
**An AI-powered wardrobe assistant that helps you understand, organize, and make better use of the clothes you already own.**
|
| 19 |
|
| 20 |
+
Built for the [Gradio Γ Hugging Face Build Small Hackathon](https://huggingface.co/build-small-hackathon) (June 2026).
|
| 21 |
|
| 22 |
+
---
|
| 23 |
+
|
| 24 |
+
## What it does
|
| 25 |
+
|
| 26 |
+
1. **Capture** β Upload photos of your clothes. AI detects individual garments, crops them, and extracts structured attributes (type, color, material, pattern, season, formality).
|
| 27 |
+
2. **Catalog** β Browse your digital wardrobe with all extracted metadata. Search and filter by any attribute.
|
| 28 |
+
3. **Combine** β Generate outfit combinations ranked by style rules. Optionally describe an occasion ("dinner on a terrace, summer") and the LLM re-ranks combinations for that context.
|
| 29 |
+
4. **Ask** β Chat with your wardrobe. "What should I wear for a job interview?" gets answered based on what you actually own.
|
| 30 |
|
| 31 |
---
|
| 32 |
|
| 33 |
+
## Tech Stack
|
| 34 |
+
|
| 35 |
+
| Component | Model / Library |
|
| 36 |
+
|-----------|----------------|
|
| 37 |
+
| Vision + Chat LLM | **Gemma 3 4B** (Q4_K_M GGUF) via `llama-cpp-python` |
|
| 38 |
+
| Garment Detection | YOLOS-tiny (`transformers`) / YOLOv8n / GroundingDINO |
|
| 39 |
+
| Runtime | llama.cpp with full GPU offload (T4) |
|
| 40 |
+
| UI | Gradio 6.17 |
|
| 41 |
+
| Storage | Local filesystem or S3 (configurable) |
|
| 42 |
|
| 43 |
+
Total parameters: **4 billion** β fits comfortably on a T4 GPU with Q4 quantization.
|
| 44 |
|
| 45 |
+
---
|
| 46 |
+
|
| 47 |
+
## Bonus Quests
|
|
|
|
|
|
|
| 48 |
|
| 49 |
+
| Badge | Status |
|
| 50 |
+
|-------|--------|
|
| 51 |
+
| π Off the Grid | All inference runs locally on the Space GPU. No external APIs. |
|
| 52 |
+
| π¦ Llama Champion | Model runs through llama.cpp runtime (`llama-cpp-python`). |
|
| 53 |
+
| π Tiny Titan | Gemma 3 4B β well under the 4B threshold. |
|
| 54 |
+
| π‘ Sharing is Caring | Agent trace shared on the Hub. |
|
| 55 |
|
| 56 |
---
|
| 57 |
|
| 58 |
+
## How to Use
|
| 59 |
|
| 60 |
+
### On HuggingFace Spaces
|
| 61 |
|
| 62 |
+
The app runs on a T4 GPU Space. On first use:
|
| 63 |
+
1. Click **"Obtener Dataset"** to load a sample wardrobe from a HuggingFace dataset (takes ~2-5 minutes as it processes each garment through the VLM).
|
| 64 |
+
2. Or upload your own clothes photos in the **Captura** tab.
|
| 65 |
+
3. Explore combinations in **Combina** and ask questions in **Pregunta**.
|
| 66 |
|
| 67 |
+
### Local Development
|
|
|
|
| 68 |
|
| 69 |
+
```bash
|
| 70 |
+
cd packages/wardrobe-us
|
| 71 |
+
python -m venv .venv && source .venv/bin/activate
|
| 72 |
+
pip install -r requirements.txt
|
| 73 |
+
python app.py
|
| 74 |
+
```
|
| 75 |
|
| 76 |
+
Requires a CUDA GPU with at least 8GB VRAM. Set `HF_TOKEN` in `.env` for model downloads.
|
| 77 |
+
|
| 78 |
+
---
|
| 79 |
+
|
| 80 |
+
## Architecture
|
| 81 |
+
|
| 82 |
+
```
|
| 83 |
+
app.py # Gradio UI entry point
|
| 84 |
+
src/
|
| 85 |
+
model_loader.py # GGUF singleton (Gemma 3 4B)
|
| 86 |
+
vision.py # VLM attribute extraction pipeline
|
| 87 |
+
detector/ # Pluggable garment detection (YOLOS/YOLOv8/GroundingDINO)
|
| 88 |
+
catalog.py # JSON catalog CRUD
|
| 89 |
+
combinations.py # Outfit generation + LLM ranking
|
| 90 |
+
assistant.py # Chat with wardrobe context
|
| 91 |
+
storage.py # Local/S3 image storage
|
| 92 |
+
settings.py # Runtime configuration
|
| 93 |
+
```
|
| 94 |
+
|
| 95 |
+
---
|
| 96 |
+
|
| 97 |
+
## Environment Variables (Secrets)
|
| 98 |
+
|
| 99 |
+
| Variable | Required | Description |
|
| 100 |
+
|----------|----------|-------------|
|
| 101 |
+
| `HF_TOKEN` | Yes | HuggingFace token for model/dataset downloads |
|
| 102 |
+
| `STORAGE_BACKEND` | No | `local` (default) or `s3` |
|
| 103 |
+
| `S3_BUCKET_NAME` | If S3 | Bucket name |
|
| 104 |
+
| `S3_ENDPOINT_URL` | If S3 | S3 endpoint |
|
| 105 |
+
| `AWS_ACCESS_KEY_ID` | If S3 | AWS credentials |
|
| 106 |
+
| `AWS_SECRET_ACCESS_KEY` | If S3 | AWS credentials |
|
| 107 |
+
| `DETECTION_BACKEND` | No | `yolos` (default), `yolov8`, or `grounding_dino` |
|
| 108 |
+
|
| 109 |
+
---
|
| 110 |
|
| 111 |
+
## License
|
| 112 |
|
| 113 |
+
MIT
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
packages.txt
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
cmake
|
| 2 |
+
build-essential
|
requirements.txt
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
|
|
| 1 |
gradio==6.17.3
|
| 2 |
llama-cpp-python>=0.3.28
|
| 3 |
huggingface-hub>=1.18.0
|
|
@@ -8,3 +9,4 @@ torch>=2.2.0
|
|
| 8 |
ultralytics>=8.3.0
|
| 9 |
gradio-image-annotation>=0.5.0
|
| 10 |
python-dotenv>=1.0.0
|
|
|
|
|
|
| 1 |
+
--extra-index-url https://abetlen.github.io/llama-cpp-python/whl/cu124
|
| 2 |
gradio==6.17.3
|
| 3 |
llama-cpp-python>=0.3.28
|
| 4 |
huggingface-hub>=1.18.0
|
|
|
|
| 9 |
ultralytics>=8.3.0
|
| 10 |
gradio-image-annotation>=0.5.0
|
| 11 |
python-dotenv>=1.0.0
|
| 12 |
+
datasets>=2.18.0
|