MedPredict is a Machine Learning powered healthcare web application that predicts the probability of major diseases based on patient medical data.
The system currently predicts the risk of:
- π§ͺ Diabetes
- β€οΈ Heart Disease
Users input medical parameters through a web interface and the system uses trained machine learning models to estimate disease risk.
This project demonstrates the integration of Machine Learning, Flask Web Development, and Cloud Deployment.
π Live Application
https://medpredict-nlff.onrender.com
- Diabetes Risk Prediction
- Heart Disease Risk Prediction
- Real-time ML predictions
- Risk probability calculation
- Risk level classification (Low / Moderate / High)
- Interactive web interface
- Cloud deployment using Render
User (Browser)
β
HTML Forms
β
Flask Backend (app.py)
β
Machine Learning Models (.pkl)
β
Prediction Result
- Python
- Scikit-learn
- XGBoost
- Pandas
- NumPy
- Flask
- HTML
- CSS
- Joblib
- Render
MedPredict
β
βββ datasets
β βββ breast_cancer.csv
β βββ diabetes_dataset.csv
β βββ heart.csv
β βββ kidney_disease.csv
β βββ synthetic_heart_disease.csv
β
βββ models
β βββ diabetes_model.pkl
β βββ heart_disease_model.pkl
β
βββ notebooks
β βββ eda
β β βββ Diabetes_EDA.ipynb
β β βββ HeartDiseases_EDA.ipynb
β β
β βββ model_training
β
βββ src
β βββ diabetes_model_testing.py
β βββ heart_disease_testing.py
β
βββ static
β βββ images
β βββ style.css
β
βββ templates
β βββ home.html
β βββ diabetes.html
β βββ heart.html
β βββ result.html
β
βββ app.py
βββ requirements.txt
βββ .gitignore
βββ README.md
The project uses trained classification models saved as .pkl files.
The diabetes model predicts whether a patient is diabetic using features like:
- Gender
- Age
- Location
- Race
- Hypertension
- Heart Disease
- Smoking History
- BMI
- HbA1c Level
- Blood Glucose Level
Prediction is based on probability threshold:
Threshold = 0.45
The heart disease model uses a pipeline model which handles preprocessing automatically.
Input features include:
- Age
- Weight
- Height
- BMI
- Hypertension
- Diabetes
- Hyperlipidemia
- Family History
- Systolic Blood Pressure
- Diastolic Blood Pressure
- Heart Rate
- Fasting Blood Sugar
- Total Cholesterol
- Gender
- Smoking
- Alcohol Intake
- Physical Activity
- Diet
- Stress Level
Prediction threshold:
Threshold = 0.30
Home Page
Options available:
- Diabetes Prediction
- Heart Disease Prediction
Example (Diabetes):
Gender
Age
Location
Race
Hypertension
Heart Disease
Smoking History
BMI
HbA1c Level
Blood Glucose Level
Example (Heart Disease):
Age
Weight
Height
BMI
Blood Pressure
Heart Rate
Blood Sugar
Cholesterol
Lifestyle Factors
Example:
age = float(request.form["age"])
bmi = float(request.form["bmi"])
hbA1c_level = float(request.form["hbA1c"])input_df = pd.DataFrame([input_data])
prob = model.predict_proba(input_df)[0][1]
if prob < 0.30 β Low Risk
if prob < 0.60 β Moderate Risk
else β High Risk
Example output:
Disease: Diabetes
Prediction: Diabetic
Probability: 67%
Risk Level: High Risk
Measures overall prediction correctness.
Accuracy = Correct Predictions / Total Predictions
Measures correctness of predicted positives.
Precision = TP / (TP + FP)
Measures how many real positive cases were detected.
Recall = TP / (TP + FN)
Predicted
No Yes
Actual No TN FP
Actual Yes FN TP
git clone https://github.com/pawan0110/MedPredict.git
cd MedPredict
python -m venv venv
Activate environment (Windows)
venv\Scripts\activate
pip install -r requirements.txt
python app.py
http://127.0.0.1:5000
The application is deployed on Render Cloud Platform.
Deployment workflow:
GitHub Repository
β
Render connects to repo
β
Install dependencies
β
Run Flask application
β
Public URL generated
Live App:
https://medpredict-nlff.onrender.com
This project is developed for educational and research purposes only.
It should not be used as a medical diagnostic tool or substitute professional healthcare advice.
Pawan Kumar
GitHub https://github.com/pawan0110