CardioSense AI analyzes uploaded ECG CSV signals using a Convolutional Neural Network (CNN), estimates heart rate, and plots the waveform in a Gradio interface.
- 🧠 AI-based ECG Classification (Normal / Abnormal)
- ❤️ Heart Rate (BPM) Calculation using R-Peak Detection
- 📈 ECG Waveform Visualization with Peak Marking
- 🌐 Interactive Web Interface (Gradio)
- Python
- TensorFlow / Keras (Deep Learning)
- Gradio (Web Interface)
- Pandas, NumPy (Data Processing)
- SciPy (Signal Processing)
- Matplotlib (Visualization)
- Render (Deployment)
- GitHub (Version Control)
CardioSense-AI/
│
├── app.py
├── ecg_cnn_model.h5
├── requirements.txt
├── render.yaml
└── README.md
git clone https://github.com/Ayushdevo/cardiosense-ai.git
cd cardiosense-ai
pip install -r requirements.txt
python app.pyOpen in browser: http://127.0.0.1:10000/
PORT overrides the default port of 10000. The model is loaded relative to
app.py, so startup also works when the process has a different working directory.
The selected ECG column must contain at least 400 finite numeric samples with some variation. Missing, infinite, text, and constant samples are rejected; removing gaps silently would change the waveform's sample timing.
pip install -r requirements-dev.txt
python -m pytest -qTests cover model startup, signal validation, concurrent plot isolation, probability validation, and a prediction using the checked-in CNN. Errors shown in the interface omit internal paths and stack traces; server logs retain the details needed to debug failures.
- Push code to GitHub
- Go to Render → New Web Service
- Connect repository
- Set:
Build Command:
pip install -r requirements.txt
Start Command:
python app.py
- Deploy
-
Upload ECG CSV file
-
Preprocessing:
- Normalize signal
- Extract segment
-
CNN Model:
- Predict Normal / Abnormal
-
Signal Processing:
- Detect peaks (SciPy)
- Compute heart rate
-
Output:
- Prediction + Confidence
- ECG waveform graph
- Model: Convolutional Neural Network (CNN)
- Input: ECG signal segment
- Output: Binary classification
- Dataset: MIT-BIH Arrhythmia Dataset
- Free hosting may be slow (cold start)
- High memory usage due to TensorFlow
- Not intended for medical diagnosis
Ayush Tiwari ECE + AI | IIT Guwahati
- Real-time ECG monitoring
- Mobile app integration
- Lightweight model optimization
- Multi-class arrhythmia detection
- MIT-BIH ECG Database
- TensorFlow & Keras
- SciPy Signal Processing