# maniraj48/garbage-classification architecture

> Architecture diagram of the GitHub repository maniraj48/garbage-classification, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-09). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/maniraj48/garbage-classification
- Repository: https://github.com/maniraj48/garbage-classification

## Overview

This is a Flask waste-image classifier: a user submits an image, the application saves and preprocesses it, runs CNN inference, and presents the predicted waste category. The README also describes six-category model training and evaluation, while the notebook is present in the tree. The trained model artifact and upload directory are not listed in the tree. The README and app.py disagree about the template location; the UI relationship is shown at the route level, not as a confirmed filesystem path.

Main entry points: [`app.py`](https://github.com/maniraj48/garbage-classification/blob/main/app.py) (Flask routes), [`index.html`](https://github.com/maniraj48/garbage-classification/blob/main/index.html) (Classifier interface), [`model.ipynb`](https://github.com/maniraj48/garbage-classification/blob/main/model.ipynb) (CNN training)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_model["Model development"]
  node_training["CNN training<br/>[model.ipynb]"]
  node_model_file["Trained CNN"]
end

subgraph group_web["Classification app"]
  node_flask_app["Flask routes<br/>[app.py]"]
  node_image_prep["Image preprocessing<br/>[app.py]"]
  node_inference["CNN inference<br/>[app.py]"]
  node_upload["Uploaded image<br/>[app.py]"]
end

subgraph group_presentation["User interface"]
  node_ui["Classifier interface<br/>[index.html]"]
end

node_user(("User"))

node_user -->|"submits image"| node_flask_app
node_flask_app -->|"renders page"| node_ui
node_flask_app -->|"saves image"| node_upload
node_flask_app -->|"preprocesses image"| node_image_prep
node_flask_app -->|"calls prediction"| node_inference
node_inference -->|"loads model"| node_model_file
node_inference -->|"returns category"| node_flask_app
node_training -.->|"produces model"| node_model_file
node_flask_app -->|"renders result"| node_ui

click node_training "https://github.com/maniraj48/garbage-classification/blob/main/model.ipynb"
click node_flask_app "https://github.com/maniraj48/garbage-classification/blob/main/app.py"
click node_image_prep "https://github.com/maniraj48/garbage-classification/blob/main/app.py"
click node_inference "https://github.com/maniraj48/garbage-classification/blob/main/app.py"
click node_upload "https://github.com/maniraj48/garbage-classification/blob/main/app.py"
click node_ui "https://github.com/maniraj48/garbage-classification/blob/main/index.html"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_training,node_model_file,node_user toneBlue
class node_flask_app,node_image_prep,node_inference,node_upload toneAmber
class node_ui toneMint
```

## Components

### Model development

- [CNN training](https://github.com/maniraj48/garbage-classification/blob/main/model.ipynb): `model.ipynb`
- **Trained CNN**

### Classification app

- [Flask routes](https://github.com/maniraj48/garbage-classification/blob/main/app.py): `app.py`
- [Image preprocessing](https://github.com/maniraj48/garbage-classification/blob/main/app.py): `app.py`
- [CNN inference](https://github.com/maniraj48/garbage-classification/blob/main/app.py): `app.py`
- [Uploaded image](https://github.com/maniraj48/garbage-classification/blob/main/app.py): `app.py`

### User interface

- [Classifier interface](https://github.com/maniraj48/garbage-classification/blob/main/index.html): `index.html`

### Other components

- **User**

## Connections

- User → Flask routes: submits image (evidence: `app.py`)
- Flask routes → Classifier interface: renders page (evidence: `app.py`)
- Flask routes → Uploaded image: saves image (evidence: `app.py`)
- Flask routes → Image preprocessing: preprocesses image (evidence: `app.py`)
- Flask routes → CNN inference: calls prediction (evidence: `app.py`)
- CNN inference → Trained CNN: loads model (evidence: `app.py`)
- CNN inference → Flask routes: returns category (evidence: `app.py`)
- CNN training → Trained CNN: produces model (evidence: `readme.md`)
- Flask routes → Classifier interface: renders result (evidence: `app.py`)
