Hearty - A Machine Learning project to train a model over health data allowing it the ability to predict whether a person is likely to get a heart disease or not. A classification model will be trained to derive the outcome i.e. heart disease to be likely i.e. 0 or not i.e. 1.
Simply install uv using the following command and sync dependencies.
pip install uv
uv syncTo run Jupyter Notebook run:
uv run jupyter labTo run FastAPI server and access interactive API doc run:
uv run fastapi run predict.pyUsing Dockerfile we can create an image with our trained model, run FastAPI server and expose a port to the api:
docker build -t hearty .
docker run -p 8000:8000 -it --rm hearty
Interactive API can then be found here.
Exploratory Data Analysis is present in notebook.ipynb.
Model training is done post EDA in notebook.ipynb.
Model training lives in its own module train.py and can be reproduced using the command
uv run python train.pyPrediction and API in its own module predict.py and can be run using
uv run fastapi run predict.pyInteractive API should be visible here.
Notebook, model training and prediction api can be easily reproduced as explain in the steps above.
Model is deployed using FastAPI defined in predict.py.
Dependency and Virtual Environment is maintained by uv, via pyproject.toml and uv.lock as defined in Local Setup.
Dockerfile handles creating image and that can be used to run API container as defined in Docker Setup.
Skipped