# bunnyispavan/alzheimer_ml architecture

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

- Interactive diagram: https://gitdiagram.com/bunnyispavan/alzheimer_ml
- Repository: https://github.com/bunnyispavan/alzheimer_ml

## Overview

This is a Flask web app for classifying Alzheimer’s disease stages from uploaded brain MRI images. A user opens the page, uploads an image, and receives a predicted stage: the server preprocesses the image, runs the loaded Keras model, and returns the result to the interface. The README also describes local model training with externally hosted data. The inference path is supported by app.py and the README; train.py was excerpted but empty, so training links are documented rather than verified in source.

Main entry points: [`app.py`](https://github.com/bunnyispavan/alzheimer_ml/blob/main/app.py) (Flask routes), [`templates/index.html`](https://github.com/bunnyispavan/alzheimer_ml/blob/main/templates/index.html) (Upload interface), [`train.py`](https://github.com/bunnyispavan/alzheimer_ml/blob/main/train.py) (Model training), [`my_model.keras`](https://github.com/bunnyispavan/alzheimer_ml/blob/main/my_model.keras) (Stage classifier)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["Web interface"]
  node_web_page["Upload interface<br/>[index.html]"]
end

subgraph group_inference["Prediction service"]
  node_flask_app["Flask routes<br/>[app.py]"]
  node_image_prep["Image preprocessing<br/>[app.py]"]
  node_classifier["Stage classifier<br/>[my_model.keras]"]
end

subgraph group_training["Model training"]
  node_training_script["Model training<br/>[train.py]"]
end

node_user(("User"))
node_browser["Browser"]
node_dataset[("Hosted dataset")]

node_user -->|"opens site"| node_browser
node_browser -->|"requests page"| node_web_page
node_web_page -->|"uploads scan"| node_flask_app
node_flask_app -->|"returns prediction"| node_web_page
node_flask_app -->|"preprocesses image"| node_image_prep
node_flask_app -->|"runs prediction"| node_classifier
node_training_script -->|"trains model"| node_classifier
node_dataset -.->|"provides data"| node_training_script

click node_web_page "https://github.com/bunnyispavan/alzheimer_ml/blob/main/templates/index.html"
click node_flask_app "https://github.com/bunnyispavan/alzheimer_ml/blob/main/app.py"
click node_image_prep "https://github.com/bunnyispavan/alzheimer_ml/blob/main/app.py"
click node_classifier "https://github.com/bunnyispavan/alzheimer_ml/blob/main/my_model.keras"
click node_training_script "https://github.com/bunnyispavan/alzheimer_ml/blob/main/train.py"

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_web_page,node_user,node_browser toneBlue
class node_flask_app,node_image_prep,node_classifier,node_dataset toneAmber
class node_training_script toneMint
```

## Components

### Web interface

- [Upload interface](https://github.com/bunnyispavan/alzheimer_ml/blob/main/templates/index.html): `templates/index.html`

### Prediction service

- [Flask routes](https://github.com/bunnyispavan/alzheimer_ml/blob/main/app.py): `app.py`
- [Image preprocessing](https://github.com/bunnyispavan/alzheimer_ml/blob/main/app.py): `app.py`
- [Stage classifier](https://github.com/bunnyispavan/alzheimer_ml/blob/main/my_model.keras): `my_model.keras`

### Model training

- [Model training](https://github.com/bunnyispavan/alzheimer_ml/blob/main/train.py): `train.py`

### Other components

- **User**
- **Browser**
- **Hosted dataset**

## Connections

- User → Browser: opens site (evidence: `README.md`)
- Browser → Upload interface: requests page (evidence: `README.md`)
- Upload interface → Flask routes: uploads scan (evidence: `README.md`)
- Flask routes → Upload interface: returns prediction (evidence: `README.md`)
- Flask routes → Image preprocessing: preprocesses image (evidence: `app.py`)
- Flask routes → Stage classifier: runs prediction (evidence: `app.py`)
- Model training → Stage classifier: trains model (evidence: `README.md`)
- Hosted dataset → Model training: provides data
