This project implements a Heart Attack Prediction Machine Learning Model that estimates the likelihood of a heart attack for a patient based on their health parameters. The model uses the Random Forest algorithm and achieves very high accuracy, making it a reliable tool for medical analysis and decision-making.
- Healthcare Providers: Aid in early diagnosis and risk assessment for heart disease.
- Hospitals: Prioritize patients based on their likelihood of a heart attack, optimizing emergency care.
- Insurance Companies: Assist in risk profiling for health insurance policies.
- Preventive Health Programs: Identify high-risk individuals for targeted interventions.
This project is a Flask-based web application that predicts the risk of a heart attack based on user input. The prediction is powered by a machine learning model.
- Interactive form to input patient details.
- Machine learning-based prediction for heart attack risk.
- Easy-to-use interface with a clean design.
-
Clone the repository:
git clone https://github.com/Onome-Joseph/Heart-Attack-Prediction.git
-
Create a virtual environment (recommended):
python -m venv venv
Activate the virtual environment:
- On Windows:
venv\Scripts\activate
- On macOS/Linux:
source venv/bin/activate
- On Windows:
-
Install required dependencies:
python !pip install Flask !pip install numpy !pip install scikit-learn !pip install pandas
-
Ensure the
classifier.pkl
file is in the root directory. This file contains the trained machine learning model. If it's missing, the app will not work. -
Start the Flask server:
python Heart_attack_FLASK.py
-
Access the web application: Open your browser and go to:
http://127.0.0.1:5000/
-
Fill in the form and get the prediction!
your-repository-name/
│
├── Heart_attack_FLASK.py # Flask application script
├── classifier.pkl # Pre-trained machine learning model
├── requirements.txt # List of Python dependencies
├── templates/
│ └── front.html # HTML template for the web app (plain design)
│ └──front2.html # HTML template for the web app (better design)
├── App preview # Layout of the frontend design (front2)
└── README.md # Project documentation
Contributions are welcome! Feel free to fork the repository, suggest improvements.