This project utilizes deep learning to classify brain tumors from MRI scans. It provides a comprehensive solution including a trained model (not included due to size), a Streamlit application for easy inference, and a detailed Jupyter notebook for model training and evaluation.
app.py: The Streamlit application interface. Use this to upload MRI images and get real-time predictions of tumor types.Brain_Tumor_Classification.ipynb: A Jupyter notebook containing the full workflow for data loading, preprocessing, transfer learning (using VGG16), model training, evaluation, and saving the final model.requirements.txt: A list of all Python dependencies required to run the project (TensorFlow, Streamlit, Pillow, NumPy, Plotly, etc.)..gitignore: Configures Git to ignore large files (like the trained model) and temporary files, preventing them from being committed to the repository.
Follow these steps to set up the project on your local machine.
First, clone the project repository from GitHub:
git clone https://github.com/pranjalparmar/brain_tumor_classifier.git
cd brain_tumor_classifierIt's recommended to use a virtual environment to manage dependencies:
python -m venv venv
source venv/bin/activate # On Windows, use: venv\Scripts\activateInstall all required Python packages using pip:
pip install -r requirements.txtTo start the Streamlit web application:
streamlit run app.pyOnce the app is running, open your web browser and navigate to http://localhost:8501. You can then upload MRI scans (in .jpg, .jpeg, or .png format). The app will display the predicted tumor type along with confidence scores.
Important Note: The trained model file (model.keras) is not included in this repository due to its large size. You will need to place your own trained model.keras file in the root project directory for the Streamlit app to function correctly.
To understand the model's architecture, train a new model, or evaluate its performance:
Open the Brain_Tumor_Classification.ipynb notebook in your preferred Jupyter environment (Jupyter Notebook or JupyterLab). Within the notebook, you can:
- Load and preprocess the MRI dataset.
- Train the deep learning model using transfer learning with VGG16.
- Evaluate the model's accuracy and other performance metrics.
- Save your newly trained model as
model.keras.
Below are some screenshots illustrating the application's interface and functionality.
Example: Streamlit App Interface showing an MRI image upload and prediction.
- The
model.kerasfile is intentionally not included in this repository as it exceeds GitHub's file size limitations (100MB). - If you don't have the
model.kerasfile, you will need to retrain the model using the provided Jupyter notebook. Alternatively, you could host the trained weights externally and provide a download link for users. - Ensure that you only upload MRI image files (
.jpg,.jpeg,.png) to the Streamlit application to avoid errors.
This project is provided for educational and research purposes only. It is not intended for clinical use or diagnostic purposes.
This project was created by Pranjal Parmar. For any questions, issues, or collaboration opportunities, please open an issue on the GitHub repository.



