Brain-MRI-Analysis / README.md
MohammedAH's picture
Update README.md
43bbc80 verified
---
title: Brain MRI Tumor Detection
emoji: 🧠
colorFrom: indigo
colorTo: purple
sdk: docker
pinned: false
---
Pure Flask application for brain MRI classification and tumor segmentation using deep learning.
# Brain MRI Analysis System
A Flask-based web application that analyzes brain MRI images for tumor classification and segmentation.
## Features
- **MRI Image Upload**: Upload brain MRI images for analysis
- **Tumor Classification**: Identifies the type of tumor (glioma, meningioma, pituitary) or confirms no tumor
- **Tumor Segmentation**: Visualizes the tumor area with an overlay if present
- **Medical Summary**: Provides a brief summary of the findings
- **Analysis History**: Stores all analyses for future reference
## Technical Stack
- **Backend**: Flask (Python)
- **Frontend**: HTML, Tailwind CSS
- **Database**: SQLite
- **Machine Learning**: TensorFlow/Keras
- **Models**:
- Brain MRI classification model (brain_mri.h5)
- U-Net segmentation model (Unet_model.h5)
## Setup Instructions
1. **Clone the repository**
2. **Install dependencies**
```
pip install -r requirements.txt
```
3. **Download the pre-trained models**
- Place the models in the root directory:
- `brain_mri.h5` (classification model)
- `Unet_model.h5` (segmentation model)
4. **Initialize the database**
- The database will be automatically created when you run the application for the first time
5. **Run the application**
```
python app.py
```
6. **Access the application**
- Open a web browser and go to `http://127.0.0.1:5000/`
## Project Structure
```
β”œβ”€β”€ app.py # Main Flask application file
β”œβ”€β”€ brain_mri.db # SQLite database (created automatically)
β”œβ”€β”€ brain_mri.h5 # Classification model
β”œβ”€β”€ Unet_model.h5 # Segmentation model
β”œβ”€β”€ requirements.txt # Dependencies
β”œβ”€β”€ static/ # Static files
β”‚ β”œβ”€β”€ uploads/ # Uploaded MRI images
β”‚ └── results/ # Generated results
└── templates/ # HTML templates
β”œβ”€β”€ base.html # Base template
β”œβ”€β”€ index.html # Homepage
β”œβ”€β”€ result.html # Results page
└── history.html # Analysis history page
```
## Notes
- This application is for educational purposes only and should not be used for actual medical diagnosis.
- The "Gemini summary" feature is simulated in this version. In a production environment, you would integrate with Google's Gemini API.