How kavin-adarsh/heart_disease_prediction works
Project type and purpose
• Full-stack, single-page/web application that serves a machine-learning model.
• Purpose: Accept patient inputs via a browser UI, run them through a Keras/TensorFlow model, and display prediction results.
File structure
• app.py – Flask entry point (backend web server & API).
• models/model_X.h5 – Pre-trained ML model artifact.
• static/ – CSS, JS, images for UI.
• templates/index.html – Jinja2 template for the HTML form and result display.
• hdPred.ipynb & heart.csv – Training pipeline (not part of production runtime, but relevant for Dev/ML component).
README
• Simple instructions to launch Flask and open the browser.
• No additional architectural sections—so we infer key components from code and folders.
Main components and their interactions
a. Client (Web Browser)
– Hosts the UI, sends HTTP requests.
b. Web Server (Flask app.py)
– Receives form data (POST), loads model, invokes prediction, renders template.
c. Model Artifact Store (models/model_X.h5)
– Persistent storage for the trained Keras model.
d. Template Engine & Static Server
– Jinja2 templates in templates/, static assets in static/.
e. (Optional) Training Pipeline
– Jupyter Notebook (hdPred.ipynb) and heart.csv data file create/validate model_X.h5.
Relationships & data flows
• Browser → HTTP GET / → Flask → templates/index.html → Browser
• Browser submits form → HTTP POST → Flask
• Flask loads model_X.h5 → TensorFlow/Keras predict() → result
• Flask renders result via template → Browser
• (In Dev) hdPred.ipynb reads heart.csv → trains model → writes model_X.h5
Architectural patterns & design principles
• MVC-style separation:
– View: HTML/CSS (templates + static)
– Controller: Flask request handlers in app.py
– Model: Keras model file
• One-process single-service architecture (could be containerized as one Docker service).
• Stateless API calls; model file loaded once on startup or per request.
Technologies & frameworks
• Python 3
• Flask (web framework)
• Jinja2 (templating)
• Keras / TensorFlow (ML inference)
• Jupyter Notebook (training)
• heart.csv – CSV dataset