# app.py from flask import Flask, request, jsonify import mlhbdapp
volumes: mlhb-data: docker compose up -d # Wait a few seconds for the DB init... docker compose logs -f mlhbdapp-server You should see a log line like:
🚀 MLHB Server listening on http://0.0.0.0:8080 Example : A tiny Flask inference API. mlhbdapp new
(mlhbdapp) – What It Is, How It Works, and Why You’ll Want It (Published March 2026 – Updated for the latest v2.3 release) TL;DR | ✅ What you’ll learn | 📌 Quick takeaways | |----------------------|--------------------| | What the MLHB App is | A lightweight, cross‑platform “ML‑Health‑Dashboard” that lets developers and data scientists monitor model performance, data drift, and resource usage in real‑time. | | Why it matters | Turns the dreaded “model‑monitoring nightmare” into a single, shareable UI that integrates with most MLOps stacks (MLflow, Weights & Biases, Vertex AI, SageMaker). | | How to get started | Install via pip install mlhbdapp , spin up a Docker container, and connect your ML pipeline with a one‑line Python hook. | | What’s new in v2.3 | Live‑query notebooks, AI‑generated anomaly explanations, native Teams/Slack alerts, and an extensible plugin SDK. | | When to use it | Any production ML system that needs transparent, low‑latency monitoring without a full‑blown APM suite. |
# Initialise the MLHB agent (auto‑starts background thread) mlhbdapp.init( service_name="demo‑sentiment‑api", version="v0.1.3", tags="team": "nlp", # optional: custom endpoint for the server endpoint="http://localhost:8080/api/v1/telemetry" ) | | Why it matters | Turns the
# Example metric: count of requests request_counter = mlhbdapp.Counter("api_requests_total")
@app.route("/predict", methods=["POST"]) def predict(): data = request.json # Simulate inference latency import time, random start = time.time() sentiment = "positive" if random.random() > 0.5 else "negative" latency = time.time() - start | | When to use it | Any
return jsonify("sentiment": sentiment, "latency_ms": latency * 1000)