# zeuidon/fashionoutfitrecommendergenai architecture

> Architecture diagram of the GitHub repository zeuidon/fashionoutfitrecommendergenai, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-15). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/zeuidon/fashionoutfitrecommendergenai
- Repository: https://github.com/zeuidon/fashionoutfitrecommendergenai

## Overview

##### Project type and purpose
- This is a full-stack web application, “FashionOutfitRecommenderGenAI,” that scrapes fashion data, fine-tunes a GenAI model, and provides a conversational UI for personalized outfit recommendations.
- The frontend (React) delivers a chat interface; the backend (FastAPI) orchestrates data retrieval, ML inference, and returns recommendations.

##### File structure
- Top level:
- Notebooks/ : Jupyter notebooks for scraping trends, fine-tuning Falcon-7B, and prototyping the chatbot.
- backend/main.py : FastAPI app exposing REST/Socket endpoints.
- dataset/ : JSON class definitions, image sets (Instagram scrape), and CSV for training.
- frontend/ : React project (App.js, components/, public/).
- No standalone database folder—dataset resides in flat files.
- No explicit microservices—everything runs under a single FastAPI service.

##### README for additional insights
- Tech stack:
- Scraper: Python + Selenium + BeautifulSoup + openai CLIP → generates image sets in dataset/.
- LLM: Transformers, LangChain, Torch, qLoRA-quantized Falcon 7B.
- Backend: Python, FastAPI.
- Frontend: React + Axios.

a. Main components to include
1. User’s browser (React app)
2. Frontend server (Node/npm dev server)
3. Backend service (FastAPI, Uvicorn)
4. Dataset storage (local JSON/CSV/image folder)
5. ML Engine:
– Scraper module (calls Selenium, BeautifulSoup, NLTK, CLIP)
– GenAI module (Falcon 7B via Transformers + BitsAndBytes)
6. External services:
– Google Search / Instagram (via Selenium)
– HuggingFace Hub or OpenAI API
b. Relationships & interactions
– Browser → HTTP/WS → Frontend server (dev proxy) → HTTP → FastAPI
– FastAPI orchestrates:
- Data ingest: reads dataset/ or triggers scraper
- Inference: calls GenAI engine for outfit generation
- Returns JSON payload to frontend
– Scraper module → External web sources → dataset/imageSet_Insta
– GenAI module → model weights (local) or HuggingFace API
c. Architectural patterns
– Container-based full-stack (C4 Container Model)
– Separation of concerns: UI vs API vs ML pipeline
– Modular ML pipeline (scrape → preprocess → fine-tune → inference)
d. Key technologies
– React components (Card, Products, Chat UI)
– Axios for HTTP calls
– FastAPI endpoints (GET/POST for chat, recommendation)
– Transformers + LangChain for LLM
– Selenium + BeautifulSoup for scraping

##### Detail without over-splitting
– You want each major function—UI, API, data, ML, external—as its own component.
– Avoid drawing every single React component; group them as “React Components.”
– Focus on data flow and boundaries.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph "Client-side"
        User["User"]:::external
        ReactUI["React UI"]:::client
        AppJS["App.js"]:::client
        Components["components/"]:::client
        Index["index.html"]:::client
        ReactUI --> AppJS
        ReactUI --> Components
        ReactUI --> Index
        FrontServer["Frontend Server\n(Node/npm dev server)"]:::client
        ReactUI -->|"Chat Request (JSON)"| FrontServer
        Package["package.json"]:::client
        Lock["package-lock.json"]:::client
        FrontServer --> Package
        FrontServer --> Lock
    end

    subgraph "Server-side"
        FastAPI["FastAPI Service"]:::server
        APIRouter["API Router"]:::server
        Scraper["Scraper Module"]:::server
        GenAI["GenAI Module"]:::server
        ChatProto["Chatbot Prototype"]:::server
        FastAPI --> APIRouter
        FastAPI --> Scraper
        FastAPI --> GenAI
        FastAPI --> ChatProto
        APIRouter -->|"200 OK + Recommendations"| ReactUI
    end

    subgraph "Data Layer"
        Bottom["bottomwear.json"]:::data
        Top["topwear.json"]:::data
        Foot["footwear.json"]:::data
        CSV["training_dataset.csv"]:::data
        Insta["imageSet_Insta/"]:::data
        OutSet["output_imageSet/"]:::data
        Scraper --> Bottom
        Scraper --> Top
        Scraper --> Foot
        Scraper --> Insta
        Scraper --> OutSet
        GenAI --> CSV
    end

    ExternalWeb[/"External Web\n(Google/Instagram)"/]:::ext
    HFAPI[/"HuggingFace/OpenAI API"/]:::ext

    Scraper -->|"scrape images"| ExternalWeb
    GenAI -->|"fetch/tune model"| HFAPI

    classDef client fill:#e0ffe0,stroke:#333,stroke-width:1px
    classDef server fill:#e0e0ff,stroke:#333,stroke-width:1px
    classDef data fill:#fff0e0,stroke:#333,stroke-width:1px
    classDef ext fill:#f0f0f0,stroke:#333,stroke-width:1px
    classDef external fill:#ffffff,stroke:#000,stroke-width:1px

    click AppJS "https://github.com/zeuidon/fashionoutfitrecommendergenai/blob/main/frontend/src/App.js"
    click Components "https://github.com/zeuidon/fashionoutfitrecommendergenai/tree/main/frontend/src/components/"
    click Index "https://github.com/zeuidon/fashionoutfitrecommendergenai/blob/main/frontend/public/index.html"
    click Package "https://github.com/zeuidon/fashionoutfitrecommendergenai/blob/main/frontend/package.json"
    click Lock "https://github.com/zeuidon/fashionoutfitrecommendergenai/blob/main/frontend/package-lock.json"
    click FastAPI "https://github.com/zeuidon/fashionoutfitrecommendergenai/blob/main/backend/main.py"
    click Bottom "https://github.com/zeuidon/fashionoutfitrecommendergenai/blob/main/dataset/classes/bottomwear.json"
    click Top "https://github.com/zeuidon/fashionoutfitrecommendergenai/blob/main/dataset/classes/topwear.json"
    click Foot "https://github.com/zeuidon/fashionoutfitrecommendergenai/blob/main/dataset/classes/footwear.json"
    click CSV "https://github.com/zeuidon/fashionoutfitrecommendergenai/blob/main/dataset/training_dataset.csv"
    click Insta "https://github.com/zeuidon/fashionoutfitrecommendergenai/tree/main/dataset/imageSet_Insta/"
    click OutSet "https://github.com/zeuidon/fashionoutfitrecommendergenai/tree/main/dataset/output_imageSet/"
    click Scraper "https://github.com/zeuidon/fashionoutfitrecommendergenai/blob/main/Notebooks/FashionTrends_Scraper.ipynb"
    click GenAI "https://github.com/zeuidon/fashionoutfitrecommendergenai/blob/main/Notebooks/Fine_tune_Falcon_7B_instruct_.ipynb"
    click ChatProto "https://github.com/zeuidon/fashionoutfitrecommendergenai/blob/main/Notebooks/Final_ChatBot.ipynb"
```
