"Transforming the Black Box of AI into a Transparent Glass for Healthcare Professionals."
HeartGlass AI is an end-to-end Machine Learning web application designed to predict the risk of heart disease with full explainability. Instead of handing doctors a rigid "black box" prediction, this platform uses SHAP (SHapley Additive exPlanations) to break down exactly why the model made its decision. This allows medical professionals to trust the model, understand the underlying factors, and make informed clinical decisions.
- High-Accuracy Predictions: Powered by an optimized
XGBoostclassifier trained on comprehensive clinical data. - Explainable AI (XAI): Interactive SHAP force plots that visually explain the impact of each patient feature (e.g., Cholesterol, Max HR, BP) on the final risk score.
- Interactive UI: A highly intuitive Streamlit interface tailored for quick data entry and immediate visual feedback.
- Production-Ready Backend: A robust REST API built with
FastAPI, ready to serve predictions at scale. - Data Validation: Strict input validation utilizing
Pydanticto ensure clinical data integrity before prediction.
The repository is modularized into distinct components to support future scalability and cloud deployment options (AWS/GCP).
- Machine Learning:
scikit-learn,xgboost,pandas,joblib - Explainability:
shap,matplotlib - Backend API:
FastAPI,Uvicorn,Pydantic - Frontend App:
Streamlit
├── ml/
│ ├── train.py # Model training & pipeline generation script
│ └── models/ # Serialized joblib artifacts (XGBoost + SHAP explainer)
├── backend/
│ └── main.py # FastAPI server exposing the /predict endpoint
├── streamlit/
│ ├── app.py # Streamlit frontend application
│ └── requirements.txt # Pinned frontend dependencies
├── frontend/ # Under Construction (Next.js/React frontend)
└── data/ # Dataset & preprocessing components
Experience the live application here: HeartGlass AI on Streamlit
Want to run this project locally? Follow these steps to spin up the environment.
git clone https://github.com/yourusername/HeartGlass-AI.git
cd "HeartGlass AI"python3 -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
pip install -r requirements.txtIf you wish to retrain the model and generate new .joblib artifacts:
python3 ml/train.pyYou have two ways to run the application locally:
Option A: Run the Streamlit Interface (Recommended)
pip install -r streamlit/requirements.txt
streamlit run streamlit/app.pyAccess the UI at http://localhost:8501
Option B: Run the FastAPI Backend
uvicorn backend.main:app --reloadAccess the interactive API documentation (Swagger UI) at http://localhost:8000/docs
- Train baseline model & integrate SHAP values.
- Build and deploy Streamlit prototype.
- Migrate the frontend to a high-performance Next.js React application.
- Containerize the full stack using Docker.
- Deploy the microservices architecture on AWS (EC2/ECS) or GCP (Cloud Run).
- Implement MLOps pipelines utilizing Evidently AI for data drift monitoring.