跳到正文
DEV Community· Parth Kulkarni·· 4 小時前AI 評分35

SlothCloset:以離線啟發式運算規劃每週穿搭

SlothCloset

AI 導讀

SlothCloset Studio 是一款離線優先、開放權重的衣櫃穿搭規劃工具,以啟發式約束圖在約 0.5ms 至 2.0ms 內生成 3–7 天的穿搭輪換。系統可設定 1–3 天的洗衣冷卻時間,並可選用透過 Ollama 運行的 Google Gemma 2 提供造型分析及單件衣物建議。

正文

Cover image for SlothCloset

Parth Kulkarni

Hacktoberfest Open-Source AI Challenge Week 3: Slow and Steady Submission 🦥

This is a submission for the Hacktoberfest Open-Source AI Challenge Week 3: Slow and Steady

What I Built

Every morning starts with the exact same low-level friction: standing half-awake in front of an open wardrobe, suffering from choice paralysis, and burning mental energy trying to figure out if an olive cargo pant clashes with a navy jersey tee or if your favorite hoodie is still in the laundry basket.

SlothCloset Studio (SLOTHCLOSET_OS) is an offline-first, open-weight wardrobe deck-builder that treats your closet like a Clash Royale deck-building constraint graph. Designed for anyone who wants to automate their daily routine and be unapologetically lazy before their morning coffee, SlothCloset eliminates morning decision fatigue in under a millisecond:

  • 🃏 Weekly Wash-Cycle Rotation Solver (3–7 Days): Computes a complete week of non-overlapping outfits in ~0.5ms to 2.0ms. It automatically enforces a configurable 1–3 day laundry/rest cooldown on tops and bottoms while allowing daily staples like watches and sneakers to rotate naturally.
  • 🔒 Standalone Outfit Synthesizer (Lock / Ban Veto): Want to wear one specific hoodie today and let math figure out the rest? Lock any garment in place (or veto items you aren't in the mood for), choose a meta style archetype (Standard Meta, Monochrome Beatdown, Earth-Tone Cycle, or High-Contrast Aggro), and synthesize high-synergy combinations with built-in anti-clone rotation.
  • 🎨 Multi-Color Swatch & Cutout Pipeline: Supports multi-color garments (up to 3–4 HEX swatches per piece), strips messy bedroom backgrounds locally using open-weight rembg (U2Net), or fetches clean studio flat-lay catalog twins via SerpApi.
  • 🧠 Tactical AI Stylist & "5th-Card Unlock": Powered by Google Gemma 2 (gemma2:2b), an optional non-blocking AI analyst writes concise synergy breakdowns for any drafted outfit and recommends a single missing wardrobe piece to unlock new combinations—complete with a live product visual pulled via SerpApi.

Demo

🚀 Live Cloud Deployment (24/7): https://sloth-closet12999.streamlit.app/

Studio UI Walkthrough (SLOTHCLOSET_OS)

00. Minimalist Landing Index:
Landing Page

01. Outfit Planner & Archetype Engine:
Outfit Planner

Standalone Outfit Builder (Force-Lock & Ban/Veto Controls):
Outfit Builder (Lock/BAN)

Weekly Rotation Matrix (3–7 Day Wash-Cycle Solver):
Weekly Builder

02. Wardrobe Asset Repository (Clean / Laundry / Skip States):
Wardrobe Assets


Code

GitHub logo p-rth12999 / Sloth-CLoset

An offline-first, open-weight wardrobe deck builder that automates your daily outfit choices so you never have to stand in front of your closet stressing out again.

🎯 The Problem Every morning comes with the exact same friction: staring into a dark wardrobe, suffering from choice paralysis, and wasting mental energy trying to figure out what pants go with what shirt. Existing wardrobe apps are bloated, invasive, and require sending personal photos of your clothes and room to third-party cloud servers.

💡 The Solution: SlothCloset Studio Inspired by Clash Royale deck-building systems and RoyaleAPI asset management, SlothCloset treats your wardrobe like a card game deck. It lets you build a Weekly Outfit Rotation in under a millisecond using offline heuristic math, features a Ban/Skip List Veto, handles Wash-Cycle Cooldowns, and leverages Google Gemma 2 (via Ollama) for deep local AI styling advice.

✨ Key Features 🃏 RoyaleAPI-Style Weekly Rotation: Automatically plans 3 to 7 days of unique non-overlapping outfits at once.

⚡ Sub-Millisecond Python Heuristic Graph: Zero-LLM latency for the core color-matching engine (~0.5ms compute time).

🧺…

(Fallback Repository Link: https://github.com/p-rth12999/Sloth-CLoset)


How I Built It

Early in development, I realized a major trap with AI-first apps: if you put an LLM directly in the critical path of generating a 7-day outfit rotation, the user has to stare at a loading spinner for 10+ seconds just to pick a t-shirt. That isn't "lazy"—that's annoying.

Instead, I architected SlothCloset around a Hybrid Heuristic + Local Open-Weight AI pipeline:

  1. Sub-Millisecond Python Constraint Graph (0.001s Core):
    • Every clothing card stores up to 3 dominant HEX codes alongside its category (Top, Layer, Bottom, Footwear, Accessory), laundry state, and ban status.
    • Using RGB luminance and HSV saturation math, the engine classifies swatches into color families (neutral_dark, neutral_light, neutral_grey, earth, warm_pop, cool) and scores pairwise color harmony against meta_rules.json archetypes.
    • For standalone builds, an anti-clone diversity penalty tracks recently drafted items on screen so every click of + Generate New Outfit rotates fresh combinations without repeating the same jacket or jeans.
  2. Open-Weight Local AI (Google Gemma 2 via Ollama & rembg U2Net):
    • Google Gemma 2 (gemma2:2b via Ollama): Rather than blocking the UI, Gemma 2 acts as an on-demand Tactical Stylist. When triggered on any outfit card, it evaluates the drafted combination in structured JSON mode, explains why the color contrast works, and identifies a "Missing Asset" that would bridge the user's current closet.
    • Open-Weight Vision (rembg / U2Net + Pillow Mediancut): When uploading a raw photo of a garment locally, rembg strips the background entirely on-device, and Pillow quantizes the remaining opaque pixels to automatically extract the garment's top 3 HEX color swatches.
  3. Dual-Runtime Frontend & Data Layer:
    • Local Studio SPA: Built with FastAPI, Tailwind CSS, and Alpine.js in a stark dark-mode developer aesthetic inspired by Andrej Karpathy's minimalist tooling and Superdesign.
    • Cloud Twin: Wrapped the exact same heuristic engine and database layer into Streamlit so anyone can test the solver 24/7 in the browser.
    • Persistence & Visuals: Backed by MongoDB Atlas (with automatic local JSON fallback for 100% offline resilience) and SerpApi Google Images to pull clean flat-lay catalog visuals for wardrobe items and Gemma 2's shopping recommendations.

Why Does Open Innovation Matter?

Your wardrobe—and photos of your bedroom, laundry, and daily habits—is deeply personal data. Existing "smart closet" apps are bloated SaaS subscriptions that force you to upload personal photos to proprietary cloud buckets and pay per API call just to organize your own clothes.

Open innovation made three critical things possible for SlothCloset that a closed API couldn't:

  1. Zero-Telemetry Privacy: By combining local Ollama (gemma2:2b) with open-weight rembg (U2Net), photos of your clothes and your daily styling queries never have to leave localhost.
  2. Zero-Cost Infinite Experimentation: A student or indie developer shouldn't have to worry about token billing every time they re-roll their weekly outfit schedule. Open weights let you run tactical styling analysis as many times as you want for $0.00.
  3. Hackable Rulesets: Because the color-harmony matrix (meta_rules.json) and constraint solver are completely transparent Python code rather than an opaque black-box prompt, anyone can fork the repo and tune the weights for their own local climate, uniform rules, or personal aesthetic.

The Lazy Payoff

Let's do the lazy math:

  • Spending 4 minutes every morning debating what to wear—or realizing your go-to shirt is still in the wash—costs nearly 30 minutes a week (over 24 hours a year) of pure decision fatigue before 8:00 AM.
  • With SlothCloset Studio, I spend 10 seconds on Sunday night clicking Generate Weekly Plan (or 1.08 ms locking in a single shirt on a random weekday morning) to get a pre-validated, color-matched rotation that already respects my laundry cycle.
  • I used it all week while building this submission: locking in my Colorblock Zip Hoodie for a chilly morning commute and letting the engine automatically pair it with Olive Relaxed Cargos and Court Sneakers without me having to think twice.

My Agent Session

During my agent-assisted build sessions, we iterated through three major architectural pivots for SlothCloset Studio:

  1. Moving the LLM out of the critical path: We pivoted from slow LLM outfit generation to a deterministic < 1.0ms Python RGB/HSV constraint solver (score_outfit_combo), keeping Google Gemma 2 (gemma2:2b) as an asynchronous Tactical Stylist.
  2. Solving the "Single-Item Clone" bottleneck: When early standalone builds kept repeating the same hoodie and sneakers, we expanded the closet to 16 multi-swatch assets and implemented an anti-clone diversity penalty that tracks recently drafted items on screen.
  3. Dual-Runtime Packaging: We paired the minimalist dark-mode FastAPI + Alpine.js local studio UI with a 24/7 Streamlit Cloud twin backed by MongoDB Atlas and SerpApi.

Prize Categories

  • Best Use of Gemma: Uses Google's open-weight Gemma 2 (gemma2:2b) model via Ollama (with cloud fallback support) in structured JSON output mode to generate on-demand outfit synergy critiques and "5th-Card Unlock" wardrobe upgrade recommendations.
  • Best Use of MongoDB Atlas: Persists multi-color wardrobe documents, live laundry states (is_clean), and veto flags (is_banned) in a MongoDB Atlas cluster with seamless local JSON fallback for offline-first reliability.
  • Best Use of SerpApi: Uses the SerpApi Google Images API in two ways: (1) converting text descriptions of clothes into clean, isolated "Studio Twin" flat-lay product visuals for the closet grid, and (2) fetching real-time shopping visuals and inspection links for Gemma 2's recommended missing wardrobe items.

來源:DEV Community · dev.to