Predicts the probability of heart disease from routine clinical + ECG-derived features using a trained ML model.
https://harpredictor.streamlit.app/
pip install -r requirements.txt
python train_model.py # optional – app auto-trains if model.joblib is missing
streamlit run app.pyThe app accepts CSV uploads in two formats:
- Encoded CSV: same columns as
Datasets/Heart Attack/heart_processed.csv(excludingHeartDisease) - Raw CSV: columns
Age, RestingBP, Cholesterol, FastingBS, MaxHR, Oldpeak, Sex, ChestPainType, RestingECG, ExerciseAngina, ST_Slope
This repo also includes a Terraform template (main.tf) that integrates Coder's product suite.
- Uses
coder_parameterto render an interactive workspace creation form in the Coder dashboard where users enter patient clinical values (age, blood pressure, chest pain type, etc.). - On workspace provision the agent clones this repo, trains the model, runs a one-shot prediction from the form values, and launches the full Streamlit app inside the workspace.
- A
coder_appresource exposes the Streamlit UI directly in the Coder dashboard.
- Import
main.tfas a template in your Coder instance. - Create a workspace — fill in the patient data form.
- The workspace provisions a Docker container, trains the model, prints the prediction result, and starts Streamlit on port 8501.
| File | Purpose |
|---|---|
main.tf |
Coder workspace template (Terraform) |
predict_from_env.py |
Reads patient values from env vars, runs prediction |
app.py |
Streamlit web app (single + batch scoring) |
model_utils.py |
Model training, saving, loading utilities |
train_model.py |
CLI script to train and export the best model |
model.joblibis gitignored; the app and workspace both auto-train on first run.- Dataset:
Datasets/Heart Attack/heart_processed.csv