Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

mlserve

https://travis-ci.com/jettify/mlserve.svg?branch=master https://codecov.io/gh/jettify/mlserve/branch/master/graph/badge.svg Maintainability https://img.shields.io/pypi/v/mlserve.svg

mlserve turns your python models into RESTful API, serves web page with form generated to match your input data.

It may be useful if one wants to demonstrate created predictive model and quickly integrate into existing application. Additionally UI is provided for input data (based on training dataframe) and simple dashboard.

Project is not complete but already usable, so no any guaranties on API or UI backward compatibility.

Online Demo

Several models deployed online using heroku.com/free free dynos. Free apps sleep automatically after 30 mins of inactivity so first request may take some time.

mlserve models one model

Ideas

mlsserve is small using following design based on following ideas:

  • Simplicity and ease of use is primary objective.

  • Application consists of two processes: IO process that runs HTTP server and responsible for fetching and sending data, as well as serve UI, other process (worker) is doing CPU intensive work related to predictions calculations.

Features

  • Model predictions serving via RESTful API endpoint.

  • Model predictions serving via generated UI.

  • Web page to simplify models usage.

  • Automatic UI generation to match your input data.

  • Simple dashboard for monitoring purposes.

Installation

Installation process is simple, just:

$ pip install git+https://github.com/jettify/mlserve.git

Example

To deploy model just follow following simple steps:

Save your model into pickle file:

with open('boston_gbr.pkl', 'wb') as f:
    pickle.dump(clf, f)

Use build_schema function to build UI representation of pandas dataframe, and save it as json file file:

import mlserve

data_schema = mlserve.build_schema(df)
with open('boston.json', 'wb') as f:
    json.dump(data_schema, f)

Create configuration file with following format:

models:
  - name: "boston_regressor"  # url friendly name
    description: "Boston GBR"  # optional model description
    model_path: "boston_gbr.pkl"  # path to your saved model
    data_schema_path: "boston.json"  # path to data representation
    target: "target"  # name of the target column

Serve model:

$ mlserve -c models.yaml

Thats it, model is available throw REST API, you can test is with curl command:

$ curl --header "Content-Type: application/json" --request POST
--data '[{"feature1": 1, "feature2": 2}]'
http://127.0.0.1:9000/api/v1/models/boston_gradient_boosting_regressor/predict

UI is available via http://127.0.0.1:9000

Supported Frameworks

  • Scikit-Learn

  • Keras (planning)

  • PyTorch (planning)

Requirements

CHANGES

Metadata

Release files for mlserve 0.0.1a6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mlserve 0.0.1a6
File Size Uploaded Provenance Actions
mlserve-0.0.1a6.tar.gz 653.6 kB Without provenance Details for mlserve-0.0.1a6.tar.gz

Release files / mlserve-0.0.1a6.tar.gz

Download URL mlserve-0.0.1a6.tar.gz
Size 653.6 kB
Tags Source
SHA-256 checksum
How to use checksums
a30cdbfc3dadcafbe688b51a75fd031cebbab58900fe5c82497ac8fe7ee0d7d7
BLAKE2b-256 checksum
How to use checksums
7689d29b3cb86b30748edfa4873de0b2bc86ddb29f6b248fec5f56c6cbf1bbea
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via Python-urllib/3.7

Security for mlserve 0.0.1a6

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page