Skip to content

junming732/your-closet

Repository files navigation

👗 The Personal Fashion Stylist: Styling What You Own

An LLM-powered fashion assistant that provides personalized outfit suggestions and fashion knowledge through a three-module Gradio interface. Built with Google Gemini 2.5 Flash and Retrieval-Augmented Generation (RAG) using FAISS vector stores.


Features

Three-Module Architecture

  1. Your Wardrobe - Manage your clothing catalog

    • Add, edit, delete items with attributes (type, color, pattern, material)
    • Bulk upload/export via CSV
    • Persistent DataFrame throughout session
  2. Build Outfit - Context-aware outfit generation

    • Form-based input (occasion, season, city)
    • Live weather integration (Visual Crossing API)
    • Optional item selection from wardrobe
    • RAG-enhanced styling advice from BeginnerGuide database
  3. Chat with Stylist - Conversational fashion assistant

    • Natural language Q&A interface
    • Intent classification (styling vs. knowledge)
    • Dual database routing (BeginnerGuide + Fashion Theory)
    • Conversation history maintained across turns

Safety & Quality Features

  • Multi-layered safety framework with pre-filtering, Gemini filters, real-time monitoring, and topic verification

  • Performance:

    • Streaming responses with real-time display
    • MMR retrieval (k=5, λ=0.5) for diverse results
    • Temperature control (0.0 for classification, 0.7 for generation, 0.9 for regeneration)

Installation & Setup

Prerequisites

Quick Start

# 1. Clone the repository
git clone <your-repo-url>
cd your-closet

# 2. Create a virtual environment
python3 -m venv .venv
source .venv/bin/activate   # Windows: .venv\Scripts\activate

# 3. Upgrade pip
python -m pip install --upgrade pip

# 4. Install dependencies
pip install -r requirements.txt

Make sure you create a .env file in the project root:

GOOGLE_API_KEY=your_google_gemini_api_key_here
VISUAL_CROSSING_API_KEY=your_weather_api_key_here  # Optional

Building the Fashion Theory RAG Index

The Fashion Theory knowledge base uses 11 academic sources from open_fashion_texts/ (traditional garment construction, fashion history, sustainability, smart textiles).

The FAISS indexes are already pre-built and included in the repository. You only need to rebuild them if you want to add, remove, or update documents in open_fashion_texts/.

To rebuild the index:

python -m src.scripts.build_fashion_theory_index

This script:

  • Loads all PDFs and TXT files from open_fashion_texts/
  • Chunks documents (chunk_size=800, overlap=120)
  • Embeds with Google's text-embedding-004
  • Saves FAISS index to faiss_index/fashion_theory/

Running the Application

python -m src.app.main

Gradio will start on http://localhost:7862


Project Structure

your-closet/
├── README.md                          
├── requirements.txt                   
├── .env                               
├── .gitignore                         # Git exclusions
│
├── src/                               
│   ├── app/
│   │   ├── main.py                    
│   │   ├── wardrobe_app.py            # Core logic
│   │   ├── safety_utils.py            # Safety filtering functions
│   │   ├── weather_utils.py           # Weather API integration
│   │   ├── ui_config.py               # Gradio theme & UI config
│   │   └── logger_config.py           # Logging setup
│   ├── retrieval/
│   │   ├── gemini_rag.py              # BeginnerGuide RAG 
│   │   └── fashion_theory_rag.py      # Fashion Theory RAG 
│   └── scripts/
│       ├── build_fashion_theory_index.py  # Build FAISS index
│       └── convert_qa_dataset.py          
│
├── tests/                             # Test scripts
│   ├── test_rag_retrieval.py          # Tab "Build Outfit" RAG tests
│   ├── test_rag_retrieval_tab3.py     # Tab "Chat with Stylist" RAG tests
│   ├── test_results_tab2.txt          # Test outputs
│   └── test_results_tab3.txt
│
├── evaluation/                        # Performance metrics
│   └── preformance_evaluation.ipynb   # Latency & quality analysis
│
├── faiss_index/                       # Pre-built FAISS indexes
│   ├── beginner_guide/                # BeginnerGuide index
│   └── fashion_theory/                # Fashion Theory index
│
├── open_fashion_texts/                # Fashion theory sources 
│   ├── ATTRIBUTIONS.txt               # Source credits
│   ├── Sustainable_Fashion_QA_Dataset.txt  (13,683 chunks)
│   └── ...10 other academic sources
│
├── sustainable_fashion.csv            # Fashion Q&A dataset
├── logs/                              # Application logs (not in git)
└── original_contributions/            # Original team work (unmodified)

Technical Details

Architecture

  • LLM: Google Gemini 2.5 Flash
  • Embeddings: text-embedding-004 (768-dimensional)
  • Vector Store: FAISS with MMR retrieval
  • UI: Gradio 5.x
  • External APIs: Visual Crossing Weather

RAG Implementation

BeginnerGuide Database:

  • Source: BeginnerGuide_howtodress_original.pdf
  • Chunks: 22 (chunk_size=800, overlap=120)
  • Used by: Tab "Build Outfit" + Tab "Chat with Stylist"

Fashion Theory Database:

  • Sources: 11 academic texts (see open_fashion_texts/ATTRIBUTIONS.txt)
  • Chunks: 16,625 total (chunk_size=800, overlap=120)
  • Used by: Tab "Chat with Stylist"

Retrieval Strategy:

  • Maximal Marginal Relevance (MMR): k=5, λ=0.5
  • Balances relevance with diversity
  • Prevents repetitive similar passages

Safety Layers

  1. Pre-filtering: Blocks 8 jailbreak phrases before API call
  2. Gemini filters: BLOCK_LOW_AND_ABOVE for 4 harm categories
  3. Real-time monitoring: Chunk-by-chunk safety validation (Tab 3 only)
  4. Topic verification: Post-generation fashion relevance check (temp=0.0)

Performance Evaluation

Results from 20 scenarios per tab with 16-item wardrobe:

Tab "Build Outfit"

  • Latency: 20.6±3.8s total, 13.9±3.1s TTFT
  • Quality: 100% completeness, 120.9% wardrobe adherence, 100% weather awareness
  • Exception handling: 10% (2/20 scenarios correctly triggered)

See evaluation/preformance_evaluation.ipynb for detailed analysis.

Tab "Chat with Stylist"

  • Latency: 15.2±6.0s total, 9.0±5.1s TTFT, 2.2±1.0s classification
  • Quality: 95% intent classification accuracy (19/20)

User Preference Study

  • Setup: 26 participants, 15 blind comparisons (our system vs. ChatGPT baseline)
  • Result: 66.5% preference for our system (13/15 wins)

Original Contributions

To keep this repo clear for reviewers, all teammates’ raw contributions are preserved unchanged inoriginal_contributions/.

All integrated code now lives in the src/ directory.


Contributors

  • Maria Katranzopoulou – Wardrobe management, Gradio UI, prompt engineering, event handlers, RAG query construction, Intent classification, Dual database routing logic
  • Dafne – RAG pipeline, prompt engineering, Weather API, Regeneration logic, RAG query construction, BeginnerGuide database setup
  • Junming – System integration, Fashion theory RAG, scraping, refactoring, RAG query construction, Conversation history management

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors