Skip to content

Dakshin10/VogueVision

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

👗 VogueVision

AI-Powered Fashion Analysis Engine

Upload any fashion image. Get semantically aware matches, gender detection, and grounded retail analysis — in seconds.


Python CLIP Groq Gradio scikit-learn



✨ What Makes It Different

Most fashion search tools match on colour and texture (ResNet-50 will match a beige suit to a beige lipstick). VogueVision uses CLIP — a vision-language model that understands semantic meaning — so a suit matches suits, coats match coats.

Feature Detail
🧠 Semantic embeddings clip-ViT-B-32 — 512-dim vectors that understand fashion context
🗂️ Category pre-filtering KMeans(8) clustering restricts search to the nearest centroid before ranking
🏆 Top-3 matches Returns three candidates with similarity scores, not a single opaque result
⚧️ Gender detection Zero-shot CLIP probe detects men's / women's / unisex and flags brand mismatches
🚫 No-match guard Scores below 50% return a clear "no confident match" message — no hallucinations
💬 Honest LLM analysis Anti-hedging instruction bans "likely / appears / may" — omit rather than hedge
🔗 Clean URLs Redirect wrappers (Tumblr ?z=, ?url=, etc.) are unwrapped before display

🚀 Quick Start

# 1 — Clone the repo
git clone https://github.com/YOUR_USERNAME/VogueVision.git
cd VogueVision

# 2 — Create and activate a virtual environment
python -m venv venv
venv\Scripts\activate          # Windows
# source venv/bin/activate     # macOS / Linux

# 3 — Install dependencies
pip install -r requirements.txt

# 4 — Configure environment variables
copy .env.example .env         # Windows
# cp .env.example .env         # macOS / Linux
# → Open .env and paste your GROQ_API_KEY

# 5 — Build the CLIP embeddings  ← required before first run
python rebuild_embeddings.py

# 6 — Launch
python app.py

Open http://localhost:7860 in your browser. Drop in any fashion photo and hit Analyse.


🏗️ Architecture

┌─────────────────────────────────────────────────────────────────┐
│                        User uploads image                        │
└───────────────────────────────┬─────────────────────────────────┘
                                │
                    ┌───────────▼───────────┐
                    │   encode_image()       │
                    │  clip-ViT-B-32 →      │
                    │  512-dim float32      │
                    └─────┬─────────┬───────┘
                          │         │
           ┌──────────────▼──┐  ┌───▼────────────────┐
           │ detect_category │  │   detect_gender()   │
           │ CLIP text probe │  │  CLIP text probe    │
           │  "outerwear"    │  │  "men's fashion"    │
           └──────────────┬──┘  └───┬────────────────┘
                          │         │
                    ┌─────▼─────────▼────┐
                    │  find_top_matches() │
                    │  ① KMeans cluster  │  → restrict to nearest centroid
                    │  ② cosine_sim      │  → rank within cluster
                    │  ③ top-3 results   │
                    └──────────┬─────────┘
                               │
               ┌───────────────▼──────────────┐
               │    similarity ≥ 0.50?         │
               │  No  → "No Close Match Found" │  (no LLM call)
               │  Yes ↓                        │
               └───────────────┬───────────────┘
                               │
                    ┌──────────▼──────────┐
                    │  generate_fashion_  │
                    │  response()         │
                    │  ① ranked items     │
                    │  ② gender note      │
                    │  ③ anti-hedging     │
                    └──────────┬──────────┘
                               │
                ┌──────────────▼───────────────────┐
                │  UI output                        │
                │  ▸ Metadata bar                   │
                │    Detected · Gender · Sim · Match │
                │  ▸ LLM analysis (Llama 3.3-70b)  │
                └───────────────────────────────────┘

📁 Project Structure

VogueVision/
│
├── app.py                   # Gradio UI + 6-step orchestration pipeline
├── config.py                # All tuneable constants (thresholds, model names)
├── rebuild_embeddings.py    # One-time CLIP embedding builder for the dataset
├── requirements.txt
├── .env.example             # ← copy to .env and fill in your keys
│
├── llm/
│   └── llm_service.py       # Groq prompt builder, retry logic, URL sanitisation
│
└── utils/
    ├── image_processor.py   # CLIP encoder · KMeans clustering · top-k search
    └── helpers.py           # Response sanitisation, refusal detection

⚙️ Configuration

Copy .env.example.env and set:

Variable Description Required
GROQ_API_KEY Your Groq API key — get one at console.groq.com
DATASET_PATH Path to the .pkl embeddings file (default: swift-style-embeddings.pkl)

Key constants in config.py:

Constant Default Effect
NO_MATCH_THRESHOLD 0.50 Below this score → no LLM call, show "no match"
SIMILARITY_THRESHOLD 0.75 Above this → treated as exact match in prompt
TOP_K_RESULTS 3 Number of candidates returned per query

📦 Dataset

The .pkl file is not committed to this repo.

It contains scraped product data and pre-computed CLIP embeddings (~5 MB for 192 items). You must generate it locally:

python rebuild_embeddings.py

The source CSV must contain these columns:

Column Description
Item Name Product name (brand + item)
Price Price string e.g. $925.00
Link Product URL (redirect wrappers are unwrapped automatically)
Image URL Direct image URL used to build embeddings

🛠️ Tech Stack

Layer Technology
Embeddings sentence-transformers/clip-ViT-B-32
Clustering scikit-learn KMeans
Similarity Cosine similarity (sklearn)
LLM Groq — llama-3.3-70b-versatile
UI Gradio 6
Data pandas + NumPy
Image Pillow + requests

🔒 Security Notes

  • .env is listed in .gitignore — your API key is never committed
  • .pkl dataset is excluded — scraped product data stays local
  • All redirect URLs are sanitised client-side before being shown to users

Built with 🖤 using CLIP · Groq · Gradio

About

AI-powered multimodal fashion analysis platform using CLIP embeddings, vector search, and Groq-powered RAG pipelines.

Topics

Resources

Stars

Watchers

Forks

Contributors

Languages