# mohammedrayhanrceg/potato-leaf-disease-detection-and-analysis architecture

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

- Interactive diagram: https://gitdiagram.com/mohammedrayhanrceg/potato-leaf-disease-detection-and-analysis
- Repository: https://github.com/mohammedrayhanrceg/potato-leaf-disease-detection-and-analysis

## Overview

This is a Flask potato-leaf disease diagnosis app. A user opens the upload form, submits an image, and the app checks whether it is a leaf and whether it is a potato leaf before classifying disease. For diseased leaves, it segments affected areas and saves an overlay; the result page presents the diagnosis and disease information. The inference, preprocessing, and routing logic are all in app.py. The README is empty, and the notebooks and model artifacts are not sampled, so their roles and connections are not represented.

Main entry points: [`app.py`](https://github.com/mohammedrayhanrceg/potato-leaf-disease-detection-and-analysis/blob/main/app.py) (Flask app), [`templates/upload.html`](https://github.com/mohammedrayhanrceg/potato-leaf-disease-detection-and-analysis/blob/main/templates/upload.html) (Upload form), [`templates/result.html`](https://github.com/mohammedrayhanrceg/potato-leaf-disease-detection-and-analysis/blob/main/templates/result.html) (Result page), [`static/uploads`](https://github.com/mohammedrayhanrceg/potato-leaf-disease-detection-and-analysis/tree/main/static/uploads) (Uploaded images)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web experience"]
  node_flask_app["Flask app<br/>[app.py]"]
  node_upload_form["Upload form<br/>[upload.html]"]
  node_result_page["Result page<br/>[result.html]"]
  node_upload_store[("Uploaded images")]
end

subgraph group_diagnosis["Image diagnosis"]
  node_leaf_gate["Leaf validation<br/>[app.py]"]
  node_potato_gate["Potato classifier<br/>[app.py]"]
  node_disease_classifier["Disease ensemble<br/>[app.py]"]
end

subgraph group_results["Disease analysis"]
  node_disease_info["Disease guidance<br/>[app.py]"]
  node_segmentation["Lesion segmentation<br/>[app.py]"]
  node_overlay_store[("Mask overlays")]
end

node_user(("User"))

node_user -->|"visits"| node_flask_app
node_flask_app -->|"renders"| node_upload_form
node_user -->|"submits image"| node_flask_app
node_flask_app -->|"saves upload"| node_upload_store
node_flask_app -->|"checks leaf"| node_leaf_gate
node_flask_app -->|"checks potato"| node_potato_gate
node_flask_app -->|"classifies disease"| node_disease_classifier
node_flask_app -->|"looks up guidance"| node_disease_info
node_flask_app -->|"segments lesions"| node_segmentation
node_flask_app -->|"writes overlay"| node_overlay_store
node_flask_app -->|"renders result"| node_result_page

click node_flask_app "https://github.com/mohammedrayhanrceg/potato-leaf-disease-detection-and-analysis/blob/main/app.py"
click node_upload_form "https://github.com/mohammedrayhanrceg/potato-leaf-disease-detection-and-analysis/blob/main/templates/upload.html"
click node_result_page "https://github.com/mohammedrayhanrceg/potato-leaf-disease-detection-and-analysis/blob/main/templates/result.html"
click node_upload_store "https://github.com/mohammedrayhanrceg/potato-leaf-disease-detection-and-analysis/tree/main/static/uploads"
click node_leaf_gate "https://github.com/mohammedrayhanrceg/potato-leaf-disease-detection-and-analysis/blob/main/app.py"
click node_potato_gate "https://github.com/mohammedrayhanrceg/potato-leaf-disease-detection-and-analysis/blob/main/app.py"
click node_disease_classifier "https://github.com/mohammedrayhanrceg/potato-leaf-disease-detection-and-analysis/blob/main/app.py"
click node_disease_info "https://github.com/mohammedrayhanrceg/potato-leaf-disease-detection-and-analysis/blob/main/app.py"
click node_segmentation "https://github.com/mohammedrayhanrceg/potato-leaf-disease-detection-and-analysis/blob/main/app.py"
click node_overlay_store "https://github.com/mohammedrayhanrceg/potato-leaf-disease-detection-and-analysis/tree/main/static/uploads"

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_app,node_upload_form,node_result_page,node_upload_store,node_user toneBlue
class node_leaf_gate,node_potato_gate,node_disease_classifier toneAmber
class node_disease_info,node_segmentation,node_overlay_store toneMint
```

## Components

### Web experience

- [Flask app](https://github.com/mohammedrayhanrceg/potato-leaf-disease-detection-and-analysis/blob/main/app.py): `app.py`
- [Upload form](https://github.com/mohammedrayhanrceg/potato-leaf-disease-detection-and-analysis/blob/main/templates/upload.html): `templates/upload.html`
- [Result page](https://github.com/mohammedrayhanrceg/potato-leaf-disease-detection-and-analysis/blob/main/templates/result.html): `templates/result.html`
- [Uploaded images](https://github.com/mohammedrayhanrceg/potato-leaf-disease-detection-and-analysis/tree/main/static/uploads): `static/uploads`

### Image diagnosis

- [Leaf validation](https://github.com/mohammedrayhanrceg/potato-leaf-disease-detection-and-analysis/blob/main/app.py): `app.py`
- [Potato classifier](https://github.com/mohammedrayhanrceg/potato-leaf-disease-detection-and-analysis/blob/main/app.py): `app.py`
- [Disease ensemble](https://github.com/mohammedrayhanrceg/potato-leaf-disease-detection-and-analysis/blob/main/app.py): `app.py`

### Disease analysis

- [Disease guidance](https://github.com/mohammedrayhanrceg/potato-leaf-disease-detection-and-analysis/blob/main/app.py): `app.py`
- [Lesion segmentation](https://github.com/mohammedrayhanrceg/potato-leaf-disease-detection-and-analysis/blob/main/app.py): `app.py`
- [Mask overlays](https://github.com/mohammedrayhanrceg/potato-leaf-disease-detection-and-analysis/tree/main/static/uploads): `static/uploads`

### Other components

- **User**

## Connections

- User → Flask app: visits (evidence: `app.py`)
- Flask app → Upload form: renders (evidence: `app.py`)
- User → Flask app: submits image (evidence: `app.py`)
- Flask app → Uploaded images: saves upload (evidence: `app.py`)
- Flask app → Leaf validation: checks leaf (evidence: `app.py`)
- Flask app → Potato classifier: checks potato (evidence: `app.py`)
- Flask app → Disease ensemble: classifies disease (evidence: `app.py`)
- Flask app → Disease guidance: looks up guidance (evidence: `app.py`)
- Flask app → Lesion segmentation: segments lesions (evidence: `app.py`)
- Flask app → Mask overlays: writes overlay (evidence: `app.py`)
- Flask app → Result page: renders result (evidence: `app.py`)
