# sanket124w/brain-tumor-prediction architecture

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

- Interactive diagram: https://gitdiagram.com/sanket124w/brain-tumor-prediction
- Repository: https://github.com/sanket124w/brain-tumor-prediction

## Overview

NeuroScan AI is a Flask web app that accepts brain MRI images and returns a binary tumor prediction with confidence. The main workflow runs from browser upload, through the `/predict` endpoint, image preprocessing, CNN inference, and result display; the server removes the temporary image after processing. The README also describes drag-and-drop, responsive presentation, and real-time feedback. The model file is documented but absent from the supplied tree. Source excerpts show the backend and JavaScript interactions; template and styling relationships are documented but not directly inspected.

Main entry points: [`app.py`](https://github.com/sanket124w/brain-tumor-prediction/blob/master/app.py) (Flask routes), [`static/js/main.js`](https://github.com/sanket124w/brain-tumor-prediction/blob/master/static/js/main.js) (Upload and results), [`templates/index.html`](https://github.com/sanket124w/brain-tumor-prediction/blob/master/templates/index.html) (Scan interface), [`static/css/style.css`](https://github.com/sanket124w/brain-tumor-prediction/blob/master/static/css/style.css) (Responsive styling)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["Web interface"]
  node_web_ui["Scan interface<br/>[index.html]"]
  node_frontend["Upload and results<br/>[main.js]"]
  node_styling["Responsive styling<br/>[style.css]"]
end

subgraph group_inference["Prediction workflow"]
  node_preprocessing["Image preprocessing<br/>[app.py]"]
  node_cnn["Pre-trained CNN"]
  node_classification["Decision and confidence<br/>[app.py]"]
end

subgraph group_runtime["Flask runtime"]
  node_flask_app["Flask routes<br/>[app.py]"]
  node_upload[("Temporary image")]
end

node_browser_user(("User"))

node_browser_user -.->|"uses"| node_web_ui
node_frontend -->|"POSTs scan"| node_flask_app
node_flask_app -->|"renders"| node_web_ui
node_web_ui -.->|"styled by"| node_styling
node_flask_app -->|"saves and deletes"| node_upload
node_flask_app -->|"preprocesses image"| node_preprocessing
node_flask_app -->|"runs inference"| node_cnn
node_flask_app -->|"classifies output"| node_classification
node_flask_app -->|"returns prediction"| node_frontend
node_frontend -->|"shows result"| node_browser_user

click node_web_ui "https://github.com/sanket124w/brain-tumor-prediction/blob/master/templates/index.html"
click node_frontend "https://github.com/sanket124w/brain-tumor-prediction/blob/master/static/js/main.js"
click node_styling "https://github.com/sanket124w/brain-tumor-prediction/blob/master/static/css/style.css"
click node_flask_app "https://github.com/sanket124w/brain-tumor-prediction/blob/master/app.py"
click node_upload "https://github.com/sanket124w/brain-tumor-prediction/tree/master/uploads"
click node_preprocessing "https://github.com/sanket124w/brain-tumor-prediction/blob/master/app.py"
click node_classification "https://github.com/sanket124w/brain-tumor-prediction/blob/master/app.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_ui,node_frontend,node_styling,node_browser_user toneBlue
class node_preprocessing,node_cnn,node_classification toneAmber
class node_flask_app,node_upload toneMint
```

## Components

### Web interface

- [Scan interface](https://github.com/sanket124w/brain-tumor-prediction/blob/master/templates/index.html): `templates/index.html`
- [Upload and results](https://github.com/sanket124w/brain-tumor-prediction/blob/master/static/js/main.js): `static/js/main.js`
- [Responsive styling](https://github.com/sanket124w/brain-tumor-prediction/blob/master/static/css/style.css): `static/css/style.css`

### Prediction workflow

- [Image preprocessing](https://github.com/sanket124w/brain-tumor-prediction/blob/master/app.py): `app.py`
- **Pre-trained CNN**
- [Decision and confidence](https://github.com/sanket124w/brain-tumor-prediction/blob/master/app.py): `app.py`

### Flask runtime

- [Flask routes](https://github.com/sanket124w/brain-tumor-prediction/blob/master/app.py): `app.py`
- [Temporary image](https://github.com/sanket124w/brain-tumor-prediction/tree/master/uploads): `uploads`

### Other components

- **User**

## Connections

- User → Scan interface: uses (evidence: `README.md`)
- Upload and results → Flask routes: POSTs scan (evidence: `static/js/main.js`)
- Flask routes → Scan interface: renders (evidence: `app.py`)
- Scan interface → Responsive styling: styled by (evidence: `README.md`)
- Flask routes → Temporary image: saves and deletes (evidence: `app.py`)
- Flask routes → Image preprocessing: preprocesses image (evidence: `app.py`)
- Flask routes → Pre-trained CNN: runs inference (evidence: `app.py`)
- Flask routes → Decision and confidence: classifies output (evidence: `app.py`)
- Flask routes → Upload and results: returns prediction (evidence: `app.py`)
- Upload and results → User: shows result (evidence: `static/js/main.js`)
