Spaces:
Runtime error
Runtime error
feat(vision): add verbose description to garment extraction
Browse files- Extend VLM prompt to request a 1-2 sentence natural language
description per garment (style, fit, notable details)
- Include description field in garment normalization
- Update get_catalog_summary() to show descriptions in LLM context,
improving outfit recommendation quality
Co-authored-by: Cursor <cursoragent@cursor.com>
- src/catalog.py +6 -1
- src/vision.py +2 -0
src/catalog.py
CHANGED
|
@@ -126,10 +126,15 @@ def get_catalog_summary() -> str:
|
|
| 126 |
pattern = g.get("pattern", "?")
|
| 127 |
season = g.get("season", "?")
|
| 128 |
formality = g.get("formality", "?")
|
| 129 |
-
|
|
|
|
|
|
|
| 130 |
f"- [{gid}] {color} {gtype} ({material}, {pattern}) "
|
| 131 |
f"| season: {season} | style: {formality}"
|
| 132 |
)
|
|
|
|
|
|
|
|
|
|
| 133 |
|
| 134 |
return "\n".join(lines)
|
| 135 |
|
|
|
|
| 126 |
pattern = g.get("pattern", "?")
|
| 127 |
season = g.get("season", "?")
|
| 128 |
formality = g.get("formality", "?")
|
| 129 |
+
description = g.get("description", "")
|
| 130 |
+
|
| 131 |
+
line = (
|
| 132 |
f"- [{gid}] {color} {gtype} ({material}, {pattern}) "
|
| 133 |
f"| season: {season} | style: {formality}"
|
| 134 |
)
|
| 135 |
+
if description:
|
| 136 |
+
line += f"\n → {description}"
|
| 137 |
+
lines.append(line)
|
| 138 |
|
| 139 |
return "\n".join(lines)
|
| 140 |
|
src/vision.py
CHANGED
|
@@ -29,6 +29,7 @@ Each object MUST have these exact fields:
|
|
| 29 |
- "pattern": pattern type ("solid", "checkered", "striped", "floral", "cable-knit", "plaid"), or "solid"
|
| 30 |
- "season": best season ("spring", "summer", "autumn", "winter", "all")
|
| 31 |
- "formality": style level ("casual", "smart-casual", "formal")
|
|
|
|
| 32 |
|
| 33 |
IMPORTANT: Only include clothing items, shoes, and fashion accessories. Do NOT include cameras, electronics, decorations, or other non-clothing objects.
|
| 34 |
|
|
@@ -101,6 +102,7 @@ def _normalize_garment(item: dict) -> dict:
|
|
| 101 |
"pattern": item.get("pattern", "solid").lower().strip(),
|
| 102 |
"season": item.get("season", "all").lower().strip(),
|
| 103 |
"formality": item.get("formality", "casual").lower().strip(),
|
|
|
|
| 104 |
}
|
| 105 |
|
| 106 |
|
|
|
|
| 29 |
- "pattern": pattern type ("solid", "checkered", "striped", "floral", "cable-knit", "plaid"), or "solid"
|
| 30 |
- "season": best season ("spring", "summer", "autumn", "winter", "all")
|
| 31 |
- "formality": style level ("casual", "smart-casual", "formal")
|
| 32 |
+
- "description": a short natural language description (1-2 sentences) of the garment including its style, fit, and any notable visual details. Example: "Chunky cable-knit oversized sweater in deep red with crew neck, warm and cozy for layering in cold weather."
|
| 33 |
|
| 34 |
IMPORTANT: Only include clothing items, shoes, and fashion accessories. Do NOT include cameras, electronics, decorations, or other non-clothing objects.
|
| 35 |
|
|
|
|
| 102 |
"pattern": item.get("pattern", "solid").lower().strip(),
|
| 103 |
"season": item.get("season", "all").lower().strip(),
|
| 104 |
"formality": item.get("formality", "casual").lower().strip(),
|
| 105 |
+
"description": item.get("description", "").strip(),
|
| 106 |
}
|
| 107 |
|
| 108 |
|