Spaces:
Runtime error
Runtime error
Upload folder using huggingface_hub
Browse files
README.md
CHANGED
|
@@ -7,65 +7,73 @@ sdk: docker
|
|
| 7 |
pinned: false
|
| 8 |
---
|
| 9 |
|
| 10 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
|
| 12 |
-
|
| 13 |
|
| 14 |
-
|
| 15 |
-

|
| 16 |
-

|
| 17 |
-

|
| 18 |
-

|
| 19 |
|
| 20 |
-
|
| 21 |
|
| 22 |
-
|
| 23 |
|
| 24 |
-
##
|
| 25 |
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
|
|
|
|
|
|
| 31 |
|
| 32 |
-
##
|
| 33 |
|
| 34 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 35 |
|
| 36 |
-
##
|
| 37 |
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
β βββ ensemble.py # Core intelligence and soft-voting aggregations
|
| 42 |
-
β βββ main.py # Websocket ingress, REST APIs, and background routines
|
| 43 |
-
β βββ preprocessing.py # State-preserving MLOps data imputation and scaling
|
| 44 |
-
βββ frontend/ # Next.js 16 UI, React Context, Framer Motion
|
| 45 |
-
β βββ src/app/ # Route segments (Dashboard, Simulator, Architecture)
|
| 46 |
-
β βββ src/components/ # Memoized, brutalist UI components for 60fps rendering
|
| 47 |
-
βββ model/ # Local LRU cache of serialized model states (.pkl)
|
| 48 |
-
βββ data/ # Immutable patient cohort datasets for MLOps
|
| 49 |
-
```
|
| 50 |
|
| 51 |
-
## Quickstart
|
| 52 |
|
| 53 |
-
### 1. Initialize the
|
| 54 |
|
| 55 |
-
|
| 56 |
|
| 57 |
```bash
|
| 58 |
cd backend
|
| 59 |
python -m venv .venv
|
| 60 |
-
source .venv/bin/activate
|
| 61 |
pip install -r requirements.txt
|
|
|
|
|
|
|
| 62 |
python models.py
|
|
|
|
|
|
|
| 63 |
uvicorn main:app --reload --port 8000
|
| 64 |
```
|
| 65 |
|
| 66 |
-
### 2. Initialize the
|
| 67 |
|
| 68 |
-
|
| 69 |
|
| 70 |
```bash
|
| 71 |
cd frontend
|
|
@@ -73,8 +81,8 @@ npm install
|
|
| 73 |
npm run dev
|
| 74 |
```
|
| 75 |
|
| 76 |
-
Navigate to `http://localhost:3000` to monitor telemetry streams, access MLOps pipelines, and export INT8 headers.
|
| 77 |
|
| 78 |
-
## License
|
| 79 |
|
| 80 |
Distributed under the MIT License. See `LICENSE` for more information.
|
|
|
|
| 7 |
pinned: false
|
| 8 |
---
|
| 9 |
|
| 10 |
+
<div align="center">
|
| 11 |
+
<h1>π« HeartFlow OS</h1>
|
| 12 |
+
<p><strong>Edge-Native Cardiovascular Telemetry & MLOps Engine</strong></p>
|
| 13 |
+
|
| 14 |
+
<p>
|
| 15 |
+
<img src="https://img.shields.io/badge/Next.js-16+-black.svg?style=for-the-badge&logo=next.js" alt="Next.js" />
|
| 16 |
+
<img src="https://img.shields.io/badge/React-19-61DAFB.svg?style=for-the-badge&logo=react&logoColor=black" alt="React" />
|
| 17 |
+
<img src="https://img.shields.io/badge/FastAPI-0.111.0+-009688.svg?style=for-the-badge&logo=fastapi" alt="FastAPI" />
|
| 18 |
+
<img src="https://img.shields.io/badge/Scikit--Learn-1.5.1+-F7931E.svg?style=for-the-badge&logo=scikit-learn&logoColor=white" alt="Scikit-Learn" />
|
| 19 |
+
<img src="https://img.shields.io/badge/License-MIT-green.svg?style=for-the-badge" alt="License" />
|
| 20 |
+
</p>
|
| 21 |
+
</div>
|
| 22 |
|
| 23 |
+
---
|
| 24 |
|
| 25 |
+
## π Overview
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
|
| 27 |
+
HeartFlow OS is a production-grade telemetry application engineered for **real-time cardiovascular inference**. It bridges the gap between cloud-scale machine learning and low-power embedded devices.
|
| 28 |
|
| 29 |
+
By ingesting high-frequency patient vitals over WebSockets, evaluating them against a distributed machine-learning ensemble, and physically compiling these models into zero-dependency C-code, HeartFlow OS provides an end-to-end pipeline from clinical dashboard to microcontroller execution.
|
| 30 |
|
| 31 |
+
## β‘ Tech Stack
|
| 32 |
|
| 33 |
+
| Domain | Technologies Used | Purpose |
|
| 34 |
+
| :--- | :--- | :--- |
|
| 35 |
+
| **Frontend** | Next.js 16 (App Router), React 19, Framer Motion | High-throughput, 60fps telemetry rendering and UI |
|
| 36 |
+
| **Backend Core** | FastAPI, Python 3.10+, Uvicorn | Async WebSocket orchestration and RESTful MLOps APIs |
|
| 37 |
+
| **Machine Learning** | Scikit-Learn, SHAP | Soft-voting ensemble (RF, SVM, KNN, LogReg, MLP) |
|
| 38 |
+
| **Database** | SQLite, `aiosqlite` | Non-blocking, asynchronous prediction logging |
|
| 39 |
+
| **Edge Compiler** | Custom Python AST Transpiler | Generates `malloc`-free, INT8 quantized C-code for MCUs |
|
| 40 |
|
| 41 |
+
## β¨ Key Features
|
| 42 |
|
| 43 |
+
- **60Hz Telemetry Interface**: A brutally fast Next.js dashboard leveraging React 19 and native WebSockets to render SVG telemetry sweeps without dropping frames.
|
| 44 |
+
- **Edge Inference & TinyML**: Transpiles complex `scikit-learn` decision boundaries into highly optimized, dependency-free C-code designed for constrained environments (bypassing dynamic memory allocation).
|
| 45 |
+
- **INT8 Quantization Engine**: Algorithmically scales 64-bit floating-point weights to 8-bit integers, shrinking the flash memory footprint by up to **75%** without meaningful accuracy loss.
|
| 46 |
+
- **Soft-Voting ML Ensemble**: Fuses predictions from five distinct model architectures to generate resilient probability distributions rather than opaque binary classifications.
|
| 47 |
+
- **Zero-Downtime MLOps**: Exposes a `/retrain` pipeline allowing for dynamic CSV uploads. It automatically imputes missing data, scales features, and retrains the entire ensemble in a background threadβhot-swapping the intelligence engine without interrupting active WebSocket streams.
|
| 48 |
|
| 49 |
+
## π System Architecture
|
| 50 |
|
| 51 |
+
The architecture adheres to a strictly decoupled design pattern split across the React client, FastAPI core, and C-compiler edge.
|
| 52 |
+
|
| 53 |
+
For a comprehensive deep-dive into data flows, system topography, and Mermaid diagrams, please read the [**Architecture Guide**](./ARCHITECTURE.md).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 54 |
|
| 55 |
+
## π Quickstart
|
| 56 |
|
| 57 |
+
### 1. Initialize the Core (Backend)
|
| 58 |
|
| 59 |
+
Requires Python 3.10 or higher.
|
| 60 |
|
| 61 |
```bash
|
| 62 |
cd backend
|
| 63 |
python -m venv .venv
|
| 64 |
+
source .venv/bin/activate # On Windows: .\.venv\Scripts\activate
|
| 65 |
pip install -r requirements.txt
|
| 66 |
+
|
| 67 |
+
# Initialize the SQLite database and train the baseline ensemble
|
| 68 |
python models.py
|
| 69 |
+
|
| 70 |
+
# Launch the async server
|
| 71 |
uvicorn main:app --reload --port 8000
|
| 72 |
```
|
| 73 |
|
| 74 |
+
### 2. Initialize the Client (Frontend)
|
| 75 |
|
| 76 |
+
Requires Node.js 18 or higher.
|
| 77 |
|
| 78 |
```bash
|
| 79 |
cd frontend
|
|
|
|
| 81 |
npm run dev
|
| 82 |
```
|
| 83 |
|
| 84 |
+
Navigate to `http://localhost:3000` to monitor live telemetry streams, access MLOps retraining pipelines, and export your INT8 TinyML headers.
|
| 85 |
|
| 86 |
+
## π License
|
| 87 |
|
| 88 |
Distributed under the MIT License. See `LICENSE` for more information.
|