# mohitsharmas97/mind-a-eye architecture

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

- Interactive diagram: https://gitdiagram.com/mohitsharmas97/mind-a-eye
- Repository: https://github.com/mohitsharmas97/mind-a-eye

## Overview

MINDAEYE is a Flask medical-image decision-support app. A signed-in user submits an MRI or fundus image; the app selects a classifier, produces a diagnosis with class probabilities and optionally a Grad-CAM heatmap, saves the prediction, and can display history or generate a PDF report. The graph separates web interaction, inference, and persistence/reporting. Training notebooks are shown as documented model-development inputs. The sampled source is partial, so uncertain internal calls are omitted or dashed.

Main entry points: [`app.py`](https://github.com/mohitsharmas97/mind-a-eye/blob/main/app.py) (Flask routes), [`models`](https://github.com/mohitsharmas97/mind-a-eye/tree/main/models) (Model weights), [`diabetic_retinopathy_tl.ipynb`](https://github.com/mohitsharmas97/mind-a-eye/blob/main/diabetic_retinopathy_tl.ipynb) (DR training), [`brain_tumor_tl.ipynb`](https://github.com/mohitsharmas97/mind-a-eye/blob/main/brain_tumor_tl.ipynb) (Brain training)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web and accounts"]
  node_flask["Flask routes<br/>[app.py]"]
  node_auth["Account auth<br/>[app.py]"]
  node_pages["Web pages"]
  node_upload["Image upload<br/>[upload.html]"]
end

subgraph group_inference["Image inference"]
  node_pipeline["Prediction runner<br/>[app.py]"]
  node_image["Image transform<br/>[app.py]"]
  node_mind["MIND classifier<br/>[app.py]"]
  node_eye["EYE classifier<br/>[app.py]"]
  node_weights["Model weights"]
  node_heatmap["Grad-CAM<br/>[app.py]"]
end

subgraph group_records["Records and reports"]
  node_prediction[("Prediction record<br/>[app.py]")]
  node_history["Prediction history<br/>[history.html]"]
  node_pdf["PDF report<br/>[app.py]"]
end

subgraph group_training["Model training"]
  node_drtrain["DR training"]
  node_braintrain["Brain training"]
end

node_user(("User"))

node_user -->|"uses"| node_flask
node_flask -->|"handles login"| node_auth
node_flask -->|"renders"| node_pages
node_user -->|"submits image"| node_upload
node_flask -->|"runs prediction"| node_pipeline
node_pipeline -->|"reads image"| node_image
node_pipeline -.->|"classifies MRI"| node_mind
node_pipeline -.->|"stages fundus"| node_eye
node_mind -.->|"loads weights"| node_weights
node_eye -.->|"loads weights"| node_weights
node_pipeline -->|"requests heatmap"| node_heatmap
node_flask -->|"saves result"| node_prediction
node_flask -->|"renders history"| node_history
node_flask -->|"generates report"| node_pdf
node_drtrain -->|"produces weights"| node_weights
node_braintrain -->|"produces weights"| node_weights

click node_flask "https://github.com/mohitsharmas97/mind-a-eye/blob/main/app.py"
click node_auth "https://github.com/mohitsharmas97/mind-a-eye/blob/main/app.py"
click node_pages "https://github.com/mohitsharmas97/mind-a-eye/tree/main/templates"
click node_upload "https://github.com/mohitsharmas97/mind-a-eye/blob/main/templates/upload.html"
click node_pipeline "https://github.com/mohitsharmas97/mind-a-eye/blob/main/app.py"
click node_image "https://github.com/mohitsharmas97/mind-a-eye/blob/main/app.py"
click node_mind "https://github.com/mohitsharmas97/mind-a-eye/blob/main/app.py"
click node_eye "https://github.com/mohitsharmas97/mind-a-eye/blob/main/app.py"
click node_weights "https://github.com/mohitsharmas97/mind-a-eye/tree/main/models"
click node_heatmap "https://github.com/mohitsharmas97/mind-a-eye/blob/main/app.py"
click node_prediction "https://github.com/mohitsharmas97/mind-a-eye/blob/main/app.py"
click node_history "https://github.com/mohitsharmas97/mind-a-eye/blob/main/templates/history.html"
click node_pdf "https://github.com/mohitsharmas97/mind-a-eye/blob/main/app.py"
click node_drtrain "https://github.com/mohitsharmas97/mind-a-eye/blob/main/diabetic_retinopathy_tl.ipynb"
click node_braintrain "https://github.com/mohitsharmas97/mind-a-eye/blob/main/brain_tumor_tl.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_auth,node_pages,node_upload,node_user toneBlue
class node_pipeline,node_image,node_mind,node_eye,node_weights,node_heatmap toneAmber
class node_prediction,node_history,node_pdf toneMint
class node_drtrain,node_braintrain toneRose
```

## Components

### Web and accounts

- [Flask routes](https://github.com/mohitsharmas97/mind-a-eye/blob/main/app.py): `app.py`
- [Account auth](https://github.com/mohitsharmas97/mind-a-eye/blob/main/app.py): `app.py`
- [Web pages](https://github.com/mohitsharmas97/mind-a-eye/tree/main/templates): `templates`
- [Image upload](https://github.com/mohitsharmas97/mind-a-eye/blob/main/templates/upload.html): `templates/upload.html`

### Image inference

- [Prediction runner](https://github.com/mohitsharmas97/mind-a-eye/blob/main/app.py): `app.py`
- [Image transform](https://github.com/mohitsharmas97/mind-a-eye/blob/main/app.py): `app.py`
- [MIND classifier](https://github.com/mohitsharmas97/mind-a-eye/blob/main/app.py): `app.py`
- [EYE classifier](https://github.com/mohitsharmas97/mind-a-eye/blob/main/app.py): `app.py`
- [Model weights](https://github.com/mohitsharmas97/mind-a-eye/tree/main/models): `models`
- [Grad-CAM](https://github.com/mohitsharmas97/mind-a-eye/blob/main/app.py): `app.py`

### Records and reports

- [Prediction record](https://github.com/mohitsharmas97/mind-a-eye/blob/main/app.py): `app.py`
- [Prediction history](https://github.com/mohitsharmas97/mind-a-eye/blob/main/templates/history.html): `templates/history.html`
- [PDF report](https://github.com/mohitsharmas97/mind-a-eye/blob/main/app.py): `app.py`

### Model training

- [DR training](https://github.com/mohitsharmas97/mind-a-eye/blob/main/diabetic_retinopathy_tl.ipynb): `diabetic_retinopathy_tl.ipynb`
- [Brain training](https://github.com/mohitsharmas97/mind-a-eye/blob/main/brain_tumor_tl.ipynb): `brain_tumor_tl.ipynb`

### Other components

- **User**

## Connections

- User → Flask routes: uses (evidence: `README.md`)
- Flask routes → Account auth: handles login (evidence: `app.py`)
- Flask routes → Web pages: renders (evidence: `app.py`)
- User → Image upload: submits image (evidence: `README.md`)
- Flask routes → Prediction runner: runs prediction (evidence: `app.py`)
- Prediction runner → Image transform: reads image (evidence: `app.py`)
- Prediction runner → MIND classifier: classifies MRI (evidence: `app.py`)
- Prediction runner → EYE classifier: stages fundus (evidence: `app.py`)
- MIND classifier → Model weights: loads weights
- EYE classifier → Model weights: loads weights
- Prediction runner → Grad-CAM: requests heatmap (evidence: `app.py`)
- Flask routes → Prediction record: saves result (evidence: `app.py`)
- Flask routes → Prediction history: renders history (evidence: `app.py`)
- Flask routes → PDF report: generates report (evidence: `app.py`)
- DR training → Model weights: produces weights (evidence: `README.md`)
- Brain training → Model weights: produces weights (evidence: `README.md`)
