# uzaam07/brain-tumor-detection architecture

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

- Interactive diagram: https://gitdiagram.com/uzaam07/brain-tumor-detection
- Repository: https://github.com/uzaam07/brain-tumor-detection

## Overview

This is a Flask brain-MRI classification app: a user selects an image, the server validates and saves it, preprocesses it for CNN inference, then displays a class, confidence, and tumor information. The README also describes training and result visualizations. The tree differs from the README’s example layout; the map uses paths that actually appear in the tree. The notebook and page contents were not sampled, so their internal behavior and wiring are not inferred.

Main entry points: [`app.py`](https://github.com/uzaam07/brain-tumor-detection/blob/main/app.py) (Flask routes), [`predict.html`](https://github.com/uzaam07/brain-tumor-detection/blob/main/predict.html) (Upload page), [`index.html`](https://github.com/uzaam07/brain-tumor-detection/blob/main/index.html) (Home page), [`brain-tumor-checkpoint.ipynb`](https://github.com/uzaam07/brain-tumor-detection/blob/main/brain-tumor-checkpoint.ipynb) (CNN training)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web experience"]
  node_home["Home page<br/>[index.html]"]
  node_upload_ui["Upload page<br/>[predict.html]"]
  node_upload_script["Upload interactions<br/>[javascript.js]"]
  node_routes["Flask routes<br/>[app.py]"]
  node_saved_image["Uploaded image<br/>[app.py]"]
  node_result_page["Result visualization<br/>[result.html]"]
end

subgraph group_inference["Classification"]
  node_preprocessing["Image preprocessing<br/>[app.py]"]
  node_classifier["CNN classifier"]
  node_class_info["Tumor information<br/>[app.py]"]
end

subgraph group_training["Model training"]
  node_training["CNN training"]
end

node_user(("MRI user"))

node_user -->|"opens"| node_home
node_home -->|"requests home"| node_routes
node_routes -->|"renders upload"| node_upload_ui
node_user -->|"selects image"| node_upload_ui
node_upload_ui -.->|"supports upload"| node_upload_script
node_user -->|"submits image"| node_routes
node_routes -->|"saves upload"| node_saved_image
node_routes -->|"calls prediction"| node_preprocessing
node_preprocessing -->|"predicts class"| node_classifier
node_routes -->|"builds result"| node_class_info
node_routes -->|"renders result"| node_result_page
node_training -.->|"trains model"| node_classifier

click node_home "https://github.com/uzaam07/brain-tumor-detection/blob/main/index.html"
click node_upload_ui "https://github.com/uzaam07/brain-tumor-detection/blob/main/predict.html"
click node_upload_script "https://github.com/uzaam07/brain-tumor-detection/blob/main/javascript.js"
click node_routes "https://github.com/uzaam07/brain-tumor-detection/blob/main/app.py"
click node_saved_image "https://github.com/uzaam07/brain-tumor-detection/blob/main/app.py"
click node_preprocessing "https://github.com/uzaam07/brain-tumor-detection/blob/main/app.py"
click node_class_info "https://github.com/uzaam07/brain-tumor-detection/blob/main/app.py"
click node_result_page "https://github.com/uzaam07/brain-tumor-detection/blob/main/result.html"
click node_training "https://github.com/uzaam07/brain-tumor-detection/blob/main/brain-tumor-checkpoint.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_home,node_upload_ui,node_upload_script,node_routes,node_saved_image,node_result_page,node_user toneBlue
class node_preprocessing,node_classifier,node_class_info toneAmber
class node_training toneMint
```

## Components

### Web experience

- [Home page](https://github.com/uzaam07/brain-tumor-detection/blob/main/index.html): `index.html`
- [Upload page](https://github.com/uzaam07/brain-tumor-detection/blob/main/predict.html): `predict.html`
- [Upload interactions](https://github.com/uzaam07/brain-tumor-detection/blob/main/javascript.js): `javascript.js`
- [Flask routes](https://github.com/uzaam07/brain-tumor-detection/blob/main/app.py): `app.py`
- [Uploaded image](https://github.com/uzaam07/brain-tumor-detection/blob/main/app.py): `app.py`
- [Result visualization](https://github.com/uzaam07/brain-tumor-detection/blob/main/result.html): `result.html`

### Classification

- [Image preprocessing](https://github.com/uzaam07/brain-tumor-detection/blob/main/app.py): `app.py`
- **CNN classifier**
- [Tumor information](https://github.com/uzaam07/brain-tumor-detection/blob/main/app.py): `app.py`

### Model training

- [CNN training](https://github.com/uzaam07/brain-tumor-detection/blob/main/brain-tumor-checkpoint.ipynb): `brain-tumor-checkpoint.ipynb`

### Other components

- **MRI user**

## Connections

- MRI user → Home page: opens (evidence: `README.md`)
- Home page → Flask routes: requests home (evidence: `app.py`)
- Flask routes → Upload page: renders upload (evidence: `app.py`)
- MRI user → Upload page: selects image (evidence: `README.md`)
- Upload page → Upload interactions: supports upload
- MRI user → Flask routes: submits image (evidence: `README.md`)
- Flask routes → Uploaded image: saves upload (evidence: `app.py`)
- Flask routes → Image preprocessing: calls prediction (evidence: `app.py`)
- Image preprocessing → CNN classifier: predicts class (evidence: `app.py`)
- Flask routes → Tumor information: builds result (evidence: `app.py`)
- Flask routes → Result visualization: renders result (evidence: `app.py`)
- CNN training → CNN classifier: trains model
