Team Ai
Apppublic

IDKHowToCodeFr/tinyml-backend

sourceHugging Faceupdated 8h agoView on Hugging Face
1likes
README.md97 linesDownload Raw Back to root
1---2title: HeartFlow OS Backend3emoji: ๐Ÿซ€4colorFrom: gray5colorTo: red6sdk: docker7pinned: false8---9 10<div align="center">11  <h1>HeartFlow OS</h1>12  <p><strong>Cardiovascular Telemetry & Edge MLOps Engine</strong></p>13  14  <p>15    <a href="https://idkhowtocodefr-tinyml-backend.hf.space/docs" target="_blank">16      <img src="https://img.shields.io/badge/๐Ÿค—_HuggingFace-API_Docs-FFD21E.svg?style=for-the-badge" alt="Hugging Face API" />17    </a>18    <a href="https://idkhowtocodefr.github.io/HEARTFLOW_OS" target="_blank">19      <img src="https://img.shields.io/badge/๐ŸŒ_Website-Live_App-black.svg?style=for-the-badge&logo=githubpages" alt="Live Website" />20    </a>21  </p>22 23  <p>24    <img src="https://img.shields.io/badge/Next.js-16+-black.svg?style=for-the-badge&logo=next.js" alt="Next.js" />25    <img src="https://img.shields.io/badge/React-19-61DAFB.svg?style=for-the-badge&logo=react&logoColor=black" alt="React" />26    <img src="https://img.shields.io/badge/FastAPI-0.111.0+-009688.svg?style=for-the-badge&logo=fastapi" alt="FastAPI" />27    <img src="https://img.shields.io/badge/PlatformIO-Edge-orange.svg?style=for-the-badge&logo=platformio&logoColor=white" alt="PlatformIO" />28    <img src="https://img.shields.io/badge/License-MIT-green.svg?style=for-the-badge" alt="License" />29  </p>30</div>31 32---33 34HeartFlow OS streams cardiovascular vitals, predicts anomalies using a soft-voting ensemble, and exports models to highly-constrained edge devices (ESP32/Arduino).35 36## System Architecture37 38| Domain | Tech | Details |39| :--- | :--- | :--- |40| **Frontend** | Next.js 16, Framer Motion | Industrial Brutalist UI with auto-healing WebSocket reconnections. |41| **Backend** | FastAPI, Python 3.10 | Real-time WebSocket routing, Telemetry simulator, and SHAP Explainability. |42| **MLOps Pipeline** | Scikit-Learn | Automated training pipelines with F1-Score evaluation and rollback protection. |43| **Edge Compiler** | Custom AST Transpiler | Exports trained ensembles to zero-dependency, INT8 quantized C headers. |44| **Firmware** | PlatformIO, C++ | Ready-to-deploy hardware wrapper for ESP32/Arduino execution. |45 46## Core Features47 48- **Fault-Tolerant Telemetry**: Streams data via WebSockets to the React dashboard with exponential backoff and UI-level auto-reconnection.49- **Automated MLOps Registry**: Upload batch CSV data to `/retrain`. The system evaluates the new models against a test set and will automatically roll back if performance (F1-score) degrades.50- **Edge Compilation (TinyML)**: Converts trained models into standalone C code (`model.h`). The generated code requires no dynamic memory allocation (`malloc`-free) and uses integer quantization to cut memory footprint by 75%.51- **Cross-Language Assurance**: Built-in test pipelines verify that the exported C logic perfectly matches the Python models before flashing to hardware.52 53## Quickstart54 55### Option 1: Docker Compose (Recommended)56 57Run the entire full-stack platform (Frontend + Backend) with a single command:58 59```bash60docker compose up --build61```62- UI available at: `http://localhost:3000`63- API Docs available at: `http://localhost:8000/docs`64 65### Option 2: Manual Local Setup66 67**Backend (Python)**68```bash69cd backend70python -m venv .venv71source .venv/bin/activate  # Windows: .\.venv\Scripts\activate72pip install -r requirements.txt73python models.py           # Seed initial models74uvicorn main:app --reload --port 800075```76 77**Frontend (Node)**78```bash79cd frontend80npm install81npm run dev82```83 84### Option 3: Hardware Firmware (Edge Deployment)85 86Once you export your `model.h` from the UI or API, deploy to your microcontroller:87 88```bash89cd firmware90# Copy your exported model.h to firmware/src/model.h91pio run -t upload92```93 94## License95 96MIT License. See `LICENSE`.97