# iamsonubisht/plant-disease-detection architecture

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

- Interactive diagram: https://gitdiagram.com/iamsonubisht/plant-disease-detection
- Repository: https://github.com/iamsonubisht/plant-disease-detection

## Overview

The repository is a plant-leaf disease classifier with a Flask web app and a documented PyTorch model workflow. The main user flow is image upload, 39-class inference, and display of disease guidance and a related supplement; the app also provides a supplement market and informational pages. The sampled Flask source supports the upload, prediction, and CSV lookup wiring. Training details are documented, but notebook internals were not sampled.

Main entry points: [`Flask Deployed App/app.py`](https://github.com/iamsonubisht/plant-disease-detection/blob/main/Flask%20Deployed%20App/app.py) (Flask routes), [`Flask Deployed App/CNN.py`](https://github.com/iamsonubisht/plant-disease-detection/blob/main/Flask%20Deployed%20App/CNN.py) (CNN classifier), [`Model/Plant Disease Detection Code.ipynb`](https://github.com/iamsonubisht/plant-disease-detection/blob/main/Model/Plant%20Disease%20Detection%20Code.ipynb) (Model training materials), [`Flask Deployed App/templates`](https://github.com/iamsonubisht/plant-disease-detection/tree/main/Flask%20Deployed%20App/templates) (Web pages)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web application"]
  node_flask["Flask routes<br/>[app.py]"]
  node_upload["Image upload<br/>[app.py]"]
  node_pages["Web pages"]
end

subgraph group_inference["Disease inference"]
  node_prediction["Image prediction<br/>[app.py]"]
  node_cnn["CNN classifier<br/>[CNN.py]"]
end

subgraph group_knowledge["Plant knowledge"]
  node_disease_data[("Disease catalogue<br/>[disease_info.csv]")]
  node_supplement_data[("Supplement catalogue")]
  node_result["Diagnosis guidance<br/>[submit.html]"]
  node_market["Supplement market<br/>[market.html]"]
end

subgraph group_modeldev["Model development"]
  node_training["Model training materials"]
end

node_farmer(("Farmer / visitor"))

node_farmer -->|"uses"| node_flask
node_flask -->|"renders"| node_pages
node_flask -->|"handles upload"| node_upload
node_upload -->|"saves image"| node_prediction
node_prediction -->|"classifies image"| node_cnn
node_flask -->|"loads / looks up"| node_disease_data
node_flask -->|"loads / looks up"| node_supplement_data
node_flask -->|"renders result"| node_result
node_flask -->|"renders market"| node_market
node_training -.->|"documents model"| node_cnn

click node_flask "https://github.com/iamsonubisht/plant-disease-detection/blob/main/Flask%20Deployed%20App/app.py"
click node_upload "https://github.com/iamsonubisht/plant-disease-detection/blob/main/Flask%20Deployed%20App/app.py"
click node_pages "https://github.com/iamsonubisht/plant-disease-detection/tree/main/Flask%20Deployed%20App/templates"
click node_prediction "https://github.com/iamsonubisht/plant-disease-detection/blob/main/Flask%20Deployed%20App/app.py"
click node_cnn "https://github.com/iamsonubisht/plant-disease-detection/blob/main/Flask%20Deployed%20App/CNN.py"
click node_disease_data "https://github.com/iamsonubisht/plant-disease-detection/blob/main/Flask%20Deployed%20App/disease_info.csv"
click node_supplement_data "https://github.com/iamsonubisht/plant-disease-detection/blob/main/Flask%20Deployed%20App/supplement_info.csv"
click node_result "https://github.com/iamsonubisht/plant-disease-detection/blob/main/Flask%20Deployed%20App/templates/submit.html"
click node_market "https://github.com/iamsonubisht/plant-disease-detection/blob/main/Flask%20Deployed%20App/templates/market.html"
click node_training "https://github.com/iamsonubisht/plant-disease-detection/blob/main/Model/Plant%20Disease%20Detection%20Code.ipynb"

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_flask,node_upload,node_pages toneBlue
class node_prediction,node_cnn toneAmber
class node_disease_data,node_supplement_data,node_result,node_market toneMint
class node_training toneRose
class node_farmer toneIndigo
```

## Components

### Web application

- [Flask routes](https://github.com/iamsonubisht/plant-disease-detection/blob/main/Flask%20Deployed%20App/app.py): `Flask Deployed App/app.py`
- [Image upload](https://github.com/iamsonubisht/plant-disease-detection/blob/main/Flask%20Deployed%20App/app.py): `Flask Deployed App/app.py`
- [Web pages](https://github.com/iamsonubisht/plant-disease-detection/tree/main/Flask%20Deployed%20App/templates): `Flask Deployed App/templates`

### Disease inference

- [Image prediction](https://github.com/iamsonubisht/plant-disease-detection/blob/main/Flask%20Deployed%20App/app.py): `Flask Deployed App/app.py`
- [CNN classifier](https://github.com/iamsonubisht/plant-disease-detection/blob/main/Flask%20Deployed%20App/CNN.py): `Flask Deployed App/CNN.py`

### Plant knowledge

- [Disease catalogue](https://github.com/iamsonubisht/plant-disease-detection/blob/main/Flask%20Deployed%20App/disease_info.csv): `Flask Deployed App/disease_info.csv`
- [Supplement catalogue](https://github.com/iamsonubisht/plant-disease-detection/blob/main/Flask%20Deployed%20App/supplement_info.csv): `Flask Deployed App/supplement_info.csv`
- [Diagnosis guidance](https://github.com/iamsonubisht/plant-disease-detection/blob/main/Flask%20Deployed%20App/templates/submit.html): `Flask Deployed App/templates/submit.html`
- [Supplement market](https://github.com/iamsonubisht/plant-disease-detection/blob/main/Flask%20Deployed%20App/templates/market.html): `Flask Deployed App/templates/market.html`

### Model development

- [Model training materials](https://github.com/iamsonubisht/plant-disease-detection/blob/main/Model/Plant%20Disease%20Detection%20Code.ipynb): `Model/Plant Disease Detection Code.ipynb`

### Other components

- **Farmer / visitor**

## Connections

- Farmer / visitor → Flask routes: uses
- Flask routes → Web pages: renders
- Flask routes → Image upload: handles upload
- Image upload → Image prediction: saves image
- Image prediction → CNN classifier: classifies image
- Flask routes → Disease catalogue: loads / looks up
- Flask routes → Supplement catalogue: loads / looks up
- Flask routes → Diagnosis guidance: renders result
- Flask routes → Supplement market: renders market
- Model training materials → CNN classifier: documents model
