# shreyasskrishna/brain_tumour_prediction architecture

> Architecture diagram of the GitHub repository shreyasskrishna/brain_tumour_prediction, 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/shreyasskrishna/brain_tumour_prediction
- Repository: https://github.com/shreyasskrishna/brain_tumour_prediction

## Overview

This repository is an MRI tumor-classification demo with a Gradio upload workflow and a separate Colab-style model-training and evaluation script. In the app, an uploaded scan is preprocessed, passed to a hybrid ResNet50/VGG16 classifier, and turned into a class, stage, and recovery-plan message. The training script builds and fits a model, then evaluates it on the test set. The README describes augmentation and evaluation capabilities; source inspection shows the app configures data generators but does not train or load a saved model. Dataset wiring is based on the shown paths; the app’s hard-coded path may need adjustment.

Main entry points: [`accuracy/backend.py`](https://github.com/shreyasskrishna/brain_tumour_prediction/blob/main/accuracy/backend.py) (Augmentation and training), [`app.py`](https://github.com/shreyasskrishna/brain_tumour_prediction/blob/main/app.py) (Prediction handler), [`dataset/Training/Training`](https://github.com/shreyasskrishna/brain_tumour_prediction/tree/main/dataset/Training/Training) (Training MRI data), [`dataset/Testing/Testing`](https://github.com/shreyasskrishna/brain_tumour_prediction/tree/main/dataset/Testing/Testing) (Testing MRI data)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["Upload and Results"]
  node_gradio["Gradio interface<br/>[app.py]"]
  node_prediction["Prediction handler<br/>[app.py]"]
  node_guidance["Class and recovery guidance<br/>[app.py]"]
end

subgraph group_inference["App Inference"]
  node_preprocess["Image preprocessing<br/>[app.py]"]
  node_hybrid["ResNet50/VGG16 classifier<br/>[app.py]"]
end

subgraph group_training["Model Training"]
  node_training_data[("Training MRI data")]
  node_test_data[("Testing MRI data")]
  node_train_pipeline["Augmentation and training<br/>[backend.py]"]
  node_trained_model["ResNet50/InceptionV3 model<br/>[backend.py]"]
end

subgraph group_evaluation["Evaluation"]
  node_evaluation["Metrics and visualizations<br/>[backend.py]"]
  node_reported_metrics["Reported performance<br/>[README.md]"]
end

node_user(("MRI user"))

node_user -->|"uploads scan"| node_gradio
node_gradio -->|"invokes handler"| node_prediction
node_prediction -->|"preprocesses image"| node_preprocess
node_prediction -->|"requests prediction"| node_hybrid
node_prediction -->|"formats result"| node_guidance
node_preprocess -->|"supplies image"| node_hybrid
node_train_pipeline -->|"reads batches"| node_training_data
node_train_pipeline -->|"reads validation batches"| node_test_data
node_train_pipeline -->|"fits model"| node_trained_model
node_train_pipeline -->|"evaluates predictions"| node_evaluation
node_evaluation -.->|"summarized by"| node_reported_metrics

click node_gradio "https://github.com/shreyasskrishna/brain_tumour_prediction/blob/main/app.py"
click node_prediction "https://github.com/shreyasskrishna/brain_tumour_prediction/blob/main/app.py"
click node_guidance "https://github.com/shreyasskrishna/brain_tumour_prediction/blob/main/app.py"
click node_preprocess "https://github.com/shreyasskrishna/brain_tumour_prediction/blob/main/app.py"
click node_hybrid "https://github.com/shreyasskrishna/brain_tumour_prediction/blob/main/app.py"
click node_training_data "https://github.com/shreyasskrishna/brain_tumour_prediction/tree/main/dataset/Training/Training"
click node_test_data "https://github.com/shreyasskrishna/brain_tumour_prediction/tree/main/dataset/Testing/Testing"
click node_train_pipeline "https://github.com/shreyasskrishna/brain_tumour_prediction/blob/main/accuracy/backend.py"
click node_trained_model "https://github.com/shreyasskrishna/brain_tumour_prediction/blob/main/accuracy/backend.py"
click node_evaluation "https://github.com/shreyasskrishna/brain_tumour_prediction/blob/main/accuracy/backend.py"
click node_reported_metrics "https://github.com/shreyasskrishna/brain_tumour_prediction/blob/main/README.md"

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_gradio,node_prediction,node_guidance,node_user toneBlue
class node_preprocess,node_hybrid toneAmber
class node_training_data,node_test_data,node_train_pipeline,node_trained_model toneMint
class node_evaluation,node_reported_metrics toneRose
```

## Components

### Upload and Results

- [Gradio interface](https://github.com/shreyasskrishna/brain_tumour_prediction/blob/main/app.py): `app.py`
- [Prediction handler](https://github.com/shreyasskrishna/brain_tumour_prediction/blob/main/app.py): `app.py`
- [Class and recovery guidance](https://github.com/shreyasskrishna/brain_tumour_prediction/blob/main/app.py): `app.py`

### App Inference

- [Image preprocessing](https://github.com/shreyasskrishna/brain_tumour_prediction/blob/main/app.py): `app.py`
- [ResNet50/VGG16 classifier](https://github.com/shreyasskrishna/brain_tumour_prediction/blob/main/app.py): `app.py`

### Model Training

- [Training MRI data](https://github.com/shreyasskrishna/brain_tumour_prediction/tree/main/dataset/Training/Training): `dataset/Training/Training`
- [Testing MRI data](https://github.com/shreyasskrishna/brain_tumour_prediction/tree/main/dataset/Testing/Testing): `dataset/Testing/Testing`
- [Augmentation and training](https://github.com/shreyasskrishna/brain_tumour_prediction/blob/main/accuracy/backend.py): `accuracy/backend.py`
- [ResNet50/InceptionV3 model](https://github.com/shreyasskrishna/brain_tumour_prediction/blob/main/accuracy/backend.py): `accuracy/backend.py`

### Evaluation

- [Metrics and visualizations](https://github.com/shreyasskrishna/brain_tumour_prediction/blob/main/accuracy/backend.py): `accuracy/backend.py`
- [Reported performance](https://github.com/shreyasskrishna/brain_tumour_prediction/blob/main/README.md): `README.md`

### Other components

- **MRI user**

## Connections

- MRI user → Gradio interface: uploads scan (evidence: `app.py`)
- Gradio interface → Prediction handler: invokes handler (evidence: `app.py`)
- Prediction handler → Image preprocessing: preprocesses image (evidence: `app.py`)
- Prediction handler → ResNet50/VGG16 classifier: requests prediction (evidence: `app.py`)
- Prediction handler → Class and recovery guidance: formats result (evidence: `app.py`)
- Image preprocessing → ResNet50/VGG16 classifier: supplies image (evidence: `app.py`)
- Augmentation and training → Training MRI data: reads batches (evidence: `accuracy/backend.py`)
- Augmentation and training → Testing MRI data: reads validation batches (evidence: `accuracy/backend.py`)
- Augmentation and training → ResNet50/InceptionV3 model: fits model (evidence: `accuracy/backend.py`)
- Augmentation and training → Metrics and visualizations: evaluates predictions (evidence: `accuracy/backend.py`)
- Metrics and visualizations → Reported performance: summarized by (evidence: `README.md`)
