[object Object]

← back to Japan Enrich

enricher: decouple slow vision (SANGETSU_VISION toggle, default off) — color pass is the goal, vision is opt-in bonus

16752c3f9c08f13d7c32436d63dc551c169e09c6 · 2026-07-01 13:40:50 -0700 · Steve Abrams

Files touched

Diff

commit 16752c3f9c08f13d7c32436d63dc551c169e09c6
Author: Steve Abrams <steve@designerwallcoverings.com>
Date:   Wed Jul 1 13:40:50 2026 -0700

    enricher: decouple slow vision (SANGETSU_VISION toggle, default off) — color pass is the goal, vision is opt-in bonus
---
 enrich_sangetsu.py | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/enrich_sangetsu.py b/enrich_sangetsu.py
index c8189e8..6fc24ef 100644
--- a/enrich_sangetsu.py
+++ b/enrich_sangetsu.py
@@ -19,6 +19,11 @@ STAGING = "staging/sangetsu-staging.jsonl"
 OUT = "out/sangetsu-enriched.jsonl"
 os.makedirs(IMG_DIR, exist_ok=True)
 
+# Vision (style/material via qwen2.5vl) is the SLOW leg (~90s+/pattern on this box).
+# color_family+hex (the primary goal) come from fast Pillow and never need it.
+# Default vision OFF so the color pass completes in minutes; opt in with SANGETSU_VISION=1.
+VISION = os.environ.get("SANGETSU_VISION", "0") != "0"
+
 def fetch(sku, url):
     dst = os.path.join(IMG_DIR, norm_sku(sku) + ".jpg")
     if os.path.exists(dst) and os.path.getsize(dst) > 0: return dst
@@ -39,7 +44,7 @@ def main():
         imgs = r.get("sku_images") or {}
         for sku, url in imgs.items():
             if url: jobs.append((sku, url))
-    print(f"sangetsu: {len(rows)} patterns, {len(jobs)} colorway images to fetch", flush=True)
+    print(f"sangetsu: {len(rows)} patterns, {len(jobs)} colorway images to fetch  (vision={'on' if VISION else 'off'})", flush=True)
     paths = {}
     done = 0
     with cf.ThreadPoolExecutor(max_workers=8) as ex:
@@ -87,7 +92,7 @@ def main():
             e = (existing.get(s) or {}).get("enrich") or {}
             if e.get("style") is not None or e.get("material") is not None:
                 style, material = e.get("style"), e.get("material"); break
-        if style is None and material is None:
+        if VISION and style is None and material is None:
             style, material = vision_tags(have[0][1]); n_vision += 1
         n_pat += 1
         for s, p in have:

← 0173358 enricher: drop unused imports (pyflakes clean)  ·  back to Japan Enrich  ·  sangetsu Cycle 2: color-family+hex enrichment complete (14,3 5f92693 →