Skip to main content

One-line deployment for trained tabular ML models

Project description

Deeploi

One-line deployment for trained tabular ML models.

Deeploi = instant API for sklearn and XGBoost → no config, no boilerplate, no DevOps required.

from deeploi import deploy

deploy(model, sample=X_train)

That's it. Your model is now serving predictions at http://127.0.0.1:8000.

Features

Instant API
One command launches a FastAPI server with /predict, /health, /meta endpoints.

Schema Inference
Learns feature names, dtypes, order from your training sample.

Artifact Packaging
Save, version, and reload models with metadata.

Prediction Probabilities
Classification models get /predict_proba endpoint automatic.

sklearn & XGBoost
Classifiers and regressors, both frameworks.

Local-First
Run anywhere — no cloud, no containers, no registry.

Quick Start

Installation

pip install deeploi

The One-Liner

from sklearn.datasets import load_iris
from sklearn.ensemble import RandomForestClassifier
from deeploi import deploy

iris = load_iris(as_frame=True)
X, y = iris.data, iris.target

model = RandomForestClassifier(n_estimators=10).fit(X, y)

deploy(model, sample=X)

Server starts at http://127.0.0.1:8000.

Test It

curl -X POST http://127.0.0.1:8000/predict \
  -H "Content-Type: application/json" \
  -d '{
    "records": [
      {
        "sepal length (cm)": 5.1,
        "sepal width (cm)": 3.5,
        "petal length (cm)": 1.4,
        "petal width (cm)": 0.2
      }
    ]
  }'

Response:

{
  "predictions": [0],
  "probabilities": [
    {"0": 0.91, "1": 0.09}
  ]
}

Core API

Three Functions

1. deploy() — One-liner, immediate serving

from deeploi import deploy

deploy(model, sample=X_train, host="127.0.0.1", port=8000)

Infers schema → packages model → starts server (blocking).

2. package() — Reusable object

from deeploi import package

pkg = package(model, sample=X_train)

# Use it
preds = pkg.predict(X_test)

# or save it
pkg.save("artifacts/iris_rf")

# or serve it later
pkg.serve(port=8000)

3. load() — Reload saved artifacts

from deeploi import load

pkg = load("artifacts/iris_rf")
preds = pkg.predict(X_test)

Endpoints

GET /health

curl http://127.0.0.1:8000/health
{
  "status": "ok",
  "version": "0.1.0"
}

GET /meta

curl http://127.0.0.1:8000/meta
{
  "framework": "sklearn",
  "estimator_class": "RandomForestClassifier",
  "task_type": "classification",
  "supports_predict_proba": true,
  "python_version": "3.11.0",
  "deeploi_version": "0.1.0",
  "created_at": "2026-03-17T12:00:00Z"
}

POST /predict

curl -X POST http://127.0.0.1:8000/predict \
  -H "Content-Type: application/json" \
  -d '{"records": [{"col_1": 1.0, "col_2": 2.0}]}'

Regression response:

{
  "predictions": [123.45, 118.91],
  "probabilities": null
}

Classification response:

{
  "predictions": [0, 1],
  "probabilities": [
    {"0": 0.91, "1": 0.09},
    {"0": 0.12, "1": 0.88}
  ]
}

POST /predict_proba

Classification models only. Same as /predict with probabilities.

curl -X POST http://127.0.0.1:8000/predict_proba \
  -H "Content-Type: application/json" \
  -d '{"records": [{"col_1": 1.0, "col_2": 2.0}]}'

Artifact Structure

When you call pkg.save("path/to/artifact"), you get:

path/to/artifact/
├── model.joblib           # Serialized model
├── metadata.json          # Versions, task type, timestamps
├── schema.json            # Features, dtypes, column order
├── deeploi.json           # Manifest
└── requirements.txt       # Dependencies

metadata.json:

{
  "framework": "sklearn",
  "estimator_class": "RandomForestClassifier",
  "task_type": "classification",
  "supports_predict_proba": true,
  "created_at": "2026-03-17T12:00:00Z",
  "python_version": "3.11.0",
  "deeploi_version": "0.1.0",
  "library_versions": {
    "sklearn": "1.5.0",
    "xgboost": "2.0.0",
    "pandas": "2.0.0"
  }
}

schema.json:

{
  "features": [
    {"name": "sepal length (cm)", "dtype": "float64", "nullable": false},
    {"name": "sepal width (cm)", "dtype": "float64", "nullable": false},
    {"name": "petal length (cm)", "dtype": "float64", "nullable": false},
    {"name": "petal width (cm)", "dtype": "float64", "nullable": false}
  ],
  "column_order": [
    "sepal length (cm)",
    "sepal width (cm)",
    "petal length (cm)",
    "petal width (cm)"
  ]
}

Examples

Scikit-learn Regressor

from sklearn.datasets import load_diabetes
from sklearn.ensemble import RandomForestRegressor
from deeploi import package

X, y = load_diabetes(return_X_y=True, as_frame=True)
model = RandomForestRegressor().fit(X, y)

pkg = package(model, X)
preds = pkg.predict(X[:5])
print(preds.to_json())

XGBoost Classifier

import pandas as pd
import xgboost as xgb
from deeploi import deploy

df = pd.read_csv("data.csv")
X = df.drop("target", axis=1)
y = df["target"]

model = xgb.XGBClassifier().fit(X, y)

deploy(model, sample=X, port=9000)

Save & Load

from deeploi import package, load

pkg = package(model, X_train)
pkg.save("artifacts/v1")

# Later...
pkg = load("artifacts/v1")
preds = pkg.predict(X_test)

Error Handling

from deeploi import package, UnsupportedModelError, InvalidSampleError

try:
    pkg = package(my_model, my_sample)
except UnsupportedModelError:
    print("Only sklearn and XGBoost are supported")
except InvalidSampleError:
    print("Sample must be a non-empty DataFrame")

What's in v0.1.0

Supported:

  • sklearn classifiers and regressors
  • XGBoost classifiers and regressors
  • pandas DataFrame inputs
  • Local FastAPI serving
  • Model save/load
  • Schema inference
  • Prediction probabilities (classifiers)

Not in v0.1.0:

  • S3 / cloud storage
  • Docker generation
  • Authentication
  • Batch inference
  • Async workers
  • Model registry
  • Monitoring

Requirements

  • Python 3.8+
  • pandas >= 1.0
  • scikit-learn >= 0.24
  • xgboost >= 1.0
  • fastapi >= 0.68
  • uvicorn >= 0.15

License

MIT. See LICENSE.


Next Steps:

  1. Try the Iris example
  2. Package your own model
  3. Deploy locally
  4. Hit /predict

Questions? Open an issue on GitHub.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

deeploi-0.1.0.tar.gz (20.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

deeploi-0.1.0-py3-none-any.whl (18.6 kB view details)

Uploaded Python 3

File details

Details for the file deeploi-0.1.0.tar.gz.

File metadata

  • Download URL: deeploi-0.1.0.tar.gz
  • Upload date:
  • Size: 20.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.20

File hashes

Hashes for deeploi-0.1.0.tar.gz
Algorithm Hash digest
SHA256 f1bb151074518acc9dc266ecf2851e0201f1de5ad9d79e3676a90ce87e2dbe12
MD5 15ead98dde0b29840ac0d56b7adb5938
BLAKE2b-256 3bc355c8f3f720ac88147d4e9cf9ea7eea8362fd511372b9e599758a65edde6a

See more details on using hashes here.

File details

Details for the file deeploi-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: deeploi-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 18.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.20

File hashes

Hashes for deeploi-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d24e42cf56482926382791aecf2ee25447fdb7b6fb952fb1e3b911ed2f00c573
MD5 9eaa05d54cc7ee8e12622031378fab86
BLAKE2b-256 fa1c47ae17228b80ef4c68c1238094a62421b3157a08c2dbe7ef8965a189e191

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page