MLup
MLup turns Python objects and serialized machine learning models into self-hosted FastAPI REST APIs without writing serving boilerplate.
Serve sklearn, PyTorch, TensorFlow, ONNX, and custom Python models through a generated FastAPI application with validation, OpenAPI docs, and health endpoints.
Quick start
pip install "pymlup[scikit-learn]"
# model.py
import pickle
from sklearn.tree import DecisionTreeClassifier
model = DecisionTreeClassifier().fit([[0, 0], [1, 1], [2, 2], [3, 3]], [0, 0, 1, 1])
with open("model.pkl", "wb") as f:
pickle.dump(model, f)
python model.py
mlup run -m model.pkl
curl -X POST http://localhost:8009/predict \
-H "Content-Type: application/json" \
-d '{"X": [[1, 1], [3, 3]]}'
# {"predict_result":[0,1]}
Interactive API docs: http://localhost:8009/docs. Full walkthrough and every option: Quickstart.
What MLup provides
- A generated FastAPI application —
up.web.appis a realfastapi.FastAPIinstance; POST /predict, with request validation built from your model's signature or a column config;- Auto-generated OpenAPI schema and Swagger UI at
/docs; GET /healthandGET /info;- Loading from serialized models (pickle, joblib, and framework-native formats) or from a plain Python object with a
predict-like method —pip install pymlupalone, no extra, covers the latter; - Optional
worker_and_queueandbatchingexecution modes for the prediction call.
Supported frameworks
| Type / framework | Typical formats | Installation extra |
|---|---|---|
| Any Python object | in-memory object with a predict-like method — no file needed |
(none, core install) |
| scikit-learn | pickle / joblib — via mlup's generic binarizers, not a dedicated adapter | pymlup[scikit-learn] |
| LightGBM | native LightGBM format, pickle, joblib | pymlup[lightgbm] |
| PyTorch | native torch formats (including TorchScript), pickle | pymlup[torch] |
| TensorFlow | SavedModel, .h5, .keras, pickle — Python <3.14 only |
pymlup[tensorflow] |
| ONNX | .onnx |
pymlup[onnx] |
See Binarizers for how model-format detection works.
When to use MLup
- You already have a trained scikit-learn, LightGBM, PyTorch, TensorFlow, or ONNX model, or a plain Python object with a
predict-like method; - You need an internal API or a small, self-hosted model service;
- You're moving a prototype out of a notebook and just need it reachable over HTTP;
- You don't need a full MLOps platform for this — just a clean serving layer.
When MLup probably isn't the right fit
- Kubernetes-native autoscaling;
- Highly optimized multi-GPU inference;
- Distributed serving graphs;
- Managed cloud deployment;
- A full MLOps lifecycle / model registry;
- A complex, application-specific HTTP API with substantial custom logic beyond serving a model.
Where to go next
- Quick Start
- Configuration file
- Python interface
- Bash commands (CLI)
- Web app API
- Migrating from 0.3.x
- Examples and test models (GitHub)
Downloads
MLup PyPI download statistics: https://pepy.tech/project/pymlup