How dhruvjoshi137/mood-match-final works
Purpose and Entry Points
Mood Match generates Pinterest-style moodboards from user text: it derives emotional/design signals, finds matching images, coordinates colors, and returns a downloadable visual result. The primary backend entry point is backend/app.py; production WSGI hosting is exposed through wsgi.py. The browser-facing UI is static HTML/CSS, centered on Main.html and Main.css.
1. Static Browser Interface
The frontend collects text input, presents generated moodboard output, and supports download-oriented interaction. It is intentionally separate from the Python service and can be opened directly or hosted as static files.
• Main.html
• Main.css
• Home.html
2. Flask API and Request Orchestration
backend/app.py is the application boundary between the browser and generation pipeline. It should own HTTP routes, input validation, invoking emotion/image/moodboard stages, and serializing generated results. Backend behavior is therefore callable independently of the static frontend.
• backend/app.py
• wsgi.py
• backend/README.md
3. Emotion and Prompt-Signal Extraction
Text is transformed into emotional labels and important terms before image selection. detect_important.py appears to isolate salient words/design concepts, while the ML package provides training and runtime inference. The dataset/keyword assets form the model’s local knowledge boundary.
• backend/detect_important.py
• backend/ML/inference.py
• backend/emotion_design_dataset.json
4. ML Training versus Runtime Inference
Model development is separated from serving: train.py builds or updates the classifier, model.py defines model-related behavior, and inference.py applies it to live user text. Production requests should use inference only; retraining is an offline workflow with dependency and model-artifact implications.
• backend/ML/train.py
• backend/ML/model.py
• backend/ML/inference.py
5. Image Discovery and Moodboard Composition
The generation stage uses external visual sources—Pinterest scraping and Pexels according to the project description—then composes selected images into a color-coordinated board. Selenium/Chrome WebDriver is a material runtime dependency for browser-driven scraping; Pillow handles image processing. Generated/intermediate image material is local to the backend image area.
• backend/app.py
• backend/images
• backend/colour.json
6. Primary Control and Data Flow
1. A user submits descriptive text through the static UI.
2. The UI calls Flask in backend/app.py.
3. Flask derives important terms and emotion/design classification via backend/detect_important.py and backend/ML/inference.py.
4. Those signals drive remote image retrieval/scraping.
5. The backend selects colors, composes images, and returns a moodboard/download response to the client.
Important boundaries are: browser ↔ Flask HTTP API; Flask ↔ local ML/data assets; backend ↔ Pinterest/Pexels; and Selenium ↔ installed Chrome/WebDriver runtime.
7. Deployment and Runtime Shape
The repository supports process-based Python deployment with a WSGI entry point and Heroku-oriented process metadata. It also includes Render/Nixpacks deployment descriptors, while the README identifies a split deployment model of backend hosting plus static frontend hosting.
• Procfile
• runtime.txt
• render.yaml
• nixpacks.toml
• requirements.txt
Main entry points: app.py Flask API · Main.html Moodboard UI · inference.py Live inference · requirements.txt Python dependencies
Components 18
Static Frontend
- Moodboard UI · Collects text, displays boards, and supports downloads.
Main.html - UI styles
Main.css - Home page
Home.html
Generation Backend
- Flask API · Validates requests and orchestrates generation.
backend/app.py - Image discovery · Uses extracted signals to obtain candidate imagery.
backend/app.py - Moodboard composition · Coordinates colors and assembles the downloadable board.
backend/app.py - Color mappings
backend/colour.json - Generated images · Stores intermediate and generated visual material.
backend/images
ML Signals
- Important-term extraction
backend/detect_important.py - Live inference · Classifies emotion and design signals for requests.
backend/ML/inference.py - Model definition
backend/ML/model.py - Offline training · Builds or updates model artifacts outside serving.
backend/ML/train.py - Emotion/design dataset
backend/emotion_design_dataset.json
Deployment Runtime
- WSGI entry
wsgi.py - Process deployment · Defines Python process-based hosting.
Procfile - Python dependencies
requirements.txt
Other components
- Pinterest and Pexels
- Chrome WebDriver · Supports browser-driven Pinterest scraping.
Connections 21
- Moodboard UI → UI styles: styled by
- Home page → Moodboard UI: links to
- Moodboard UI → Flask API: HTTP generation request
- WSGI entry → Flask API: serves
- Flask API → Important-term extraction: extracts terms
- Flask API → Live inference: classifies text
- Important-term extraction → Image discovery: search signals
- Live inference → Image discovery: emotion/design signals
- Live inference → Model definition: uses
- Offline training → Model definition: trains
- Emotion/design dataset → Offline training: training data
- Image discovery → Pinterest and Pexels: retrieves images
- Image discovery → Chrome WebDriver: scraping runtime
- Image discovery → Moodboard composition: selected images
- Color mappings → Moodboard composition: color coordination
- Moodboard composition → Generated images: writes board assets
- Moodboard composition → Flask API: generated result
- Flask API → Moodboard UI: moodboard response
- Process deployment → WSGI entry: launches
- Python dependencies → Flask API: provides runtime packages
- Python dependencies → Chrome WebDriver: provides automation package