An ML-powered, educational web application that demonstrates how machine learning, Bayesian probability, and AI can be used to estimate disease likelihood based on symptoms and diagnostic test results.
This project is designed to make diagnostic reasoning transparent, intuitive, and interactive - especially for students, researchers, and developers exploring medical ML concepts.
Educational Use Only
This project is intended strictly for learning, research, and demonstration purposes.
It is not a medical tool and must not be used for real-world diagnosis or treatment decisions.
Always consult a qualified healthcare professional for medical advice.
- ๐ฌ Combines Machine Learning + Bayesian Inference
- ๐ Visual comparison of prior vs posterior probabilities
- ๐ค AI-powered explanations & next-step recommendations
- ๐ Multi-language support (English, Hindi, Gujarati, Tamil)
- ๐ Dark mode for better accessibility
- ๐ Beginner-friendly educational explanations
- Quick Start (30 seconds)
- Key Features
- Using AI-Powered Recommendations
- Bayesโ Theorem Explained
- Troubleshooting
- Privacy & Data Handling
- Dataset & Model
- License
git clone https://github.com/aliviahossain/Disease-prediction.git
cd Disease-prediction
pip install -r requirements.txt
python run.pyOpen in your browser: ๐ http://127.0.0.1:5001/
Thatโs it ๐
- Clear explanations of Prior, Likelihood, and Posterior Probability
- Step-by-step visualization of Bayesโ Theorem
- Interactive probability sliders for experimentation
- Built-in glossary and help section
- Symptom-based disease prediction
- Disease selection with predefined symptom sets
- ML-generated probability scores
- Risk categorization (Low / Medium / High)
- AI-powered interpretation of probability results
- Suggested next steps (consultation, testing, lifestyle review)
- Multi-language AI output:
- ๐ฌ๐ง English
- ๐ฎ๐ณ Hindi
- ๐ฎ๐ณ Gujarati
- ๐ฎ๐ณ Tamil
Powered by Google Gemini API
Disease-prediction/
โโโ run.py # Application entry point
โโโ dashboard.py # Streamlit interactive dashboard
โโโ requirements.txt # Python dependencies
โโโ hospital_data.csv # Sample statistical data
โโโ backend/
โ โโโ routes/ # Flask routes (auth, ML, calculator)
โ โโโ models/ # Database & ML models
โ โโโ utils/ # Bayesian calculator & AI helpers
โ โโโ static/ # JS & CSS
โ โโโ templates/ # HTML templates
โโโ README.md
โโโ LICENSE
โโโ Scalability_report.txtpython -m venv venv
source venv/bin/activate # macOS/Linux
venv\Scripts\activate # Windowspip install -r requirements.txtpython run.pyEnable Gemini AI (Optional but Recommended)
Step 1: Get an API Key
Get your free API key from Google AI Studio
Step 2: Configure the API Key
Using .env file (recommended):
GEMINI_API_KEY=your_api_key_hereOr via environment variable:
export GEMINI_API_KEY=your_api_key_here # macOS/Linux- Calculate disease probability
- Choose a language ๐
- Click โGet AI Recommendationsโ
- Receive:
- Probability interpretation
- Suggested next actions
- Medical disclaimers
Bayesโ Theorem updates the probability of a condition after observing new evidence, such as a test result.
P(A|B) = [P(B|A) ร P(A)] / [P(B|A) ร P(A) + P(B|ยฌA) ร P(ยฌA)]Where:
- P(A) โ Prior probability
- P(B|A) โ Sensitivity
- P(B|ยฌA) โ False positive rate
- P(A|B) โ Posterior probability
This project visualizes this shift clearly using charts and explanations.
- Ensure
GEMINI_API_KEYis set - Restart the application
- Check internet connectivity
- Verify API quota availability
- Confirm Python โฅ 3.9
- Reinstall dependencies
- Activate virtual environment
All image processing and probability calculations are performed locally on the userโs machine.
No images, symptoms, or personal data are uploaded, stored, or shared externally by default.
The eye-disease image classification model is based on a deep convolutional neural network using a ResNet architecture inspired by:
He, K., Zhang, X., Ren, S., & Sun, J. (2016).
Deep Residual Learning for Image Recognition. Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR).
The eye-disease image prediction model was trained using the following publicly available dataset from Kaggle:
- Eye Diseases Classification Dataset
https://www.kaggle.com/datasets/gunavenkatdoddi/eye-diseases-classification
This dataset includes labeled images for:
- Normal eyes
- Glaucoma
- Diabetic Retinopathy
- Cataract
The skin-disease image prediction model was trained using the following publicly available dataset from Kaggle:
- Skin Diseases Image Dataset https://www.kaggle.com/datasets/ismailpromus/skin-diseases-image-dataset
This dataset includes labeled images for the following conditions:
- Atopic Dermatitis
- Basal Cell Carcinoma
- Benign Keratosis-like Lesions
- Eczema
- Melanocytic Nevi
- Melanoma
- Psoriasis
- Seborrheic Keratoses and other Benign Tumors
- Tinea Ringworm, Candidiasis, and other Fungal Infections
- Warts, Molluscum, and other Viral Infections
All dataset credits belong to their respective authors and contributors. This project does not claim ownership of the dataset. Please refer to the dataset page for licensing and usage terms.
- All computations run locally
- No personal data is stored or transmitted
- AI requests only include probability values (no user identity)
- Eye Diseases Classification Dataset (Kaggle)
- Normal
- Glaucoma
- Diabetic Retinopathy
- Cataract
- CNN based on ResNet
- Inspired by He et al., 2016 - Deep Residual Learning
This project is licensed under the MIT License. See the LICENSE file for details.
Created and maintained by Alivia Hossain.
Contributions are welcome, feel free to open issues or pull requests.
โญ If you find this project useful, consider giving it a star!