Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ml-libs/mlserve
mlserve turns your python models into RESTful API, serves web page with form generated to match your input data.
https://github.com/ml-libs/mlserve
machine-learning mlserve model-deployment model-serving scikit-learn
Last synced: 22 days ago
JSON representation
mlserve turns your python models into RESTful API, serves web page with form generated to match your input data.
- Host: GitHub
- URL: https://github.com/ml-libs/mlserve
- Owner: ml-libs
- License: apache-2.0
- Created: 2018-07-28T10:48:59.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2022-12-08T18:56:19.000Z (almost 2 years ago)
- Last Synced: 2024-10-11T23:10:34.462Z (25 days ago)
- Topics: machine-learning, mlserve, model-deployment, model-serving, scikit-learn
- Language: Python
- Homepage: https://github.com/ml-libs/mlserve
- Size: 7.6 MB
- Stars: 27
- Watchers: 3
- Forks: 1
- Open Issues: 24
-
Metadata Files:
- Readme: README.rst
- Changelog: CHANGES.txt
- Contributing: CONTRIBUTING.rst
- License: LICENSE
Awesome Lists containing this project
README
mlserve
=======
.. image:: https://travis-ci.com/ml-libs/mlserve.svg?branch=master
:target: https://travis-ci.com/ml-libs/mlserve
.. image:: https://codecov.io/gh/ml-libs/mlserve/branch/master/graph/badge.svg
:target: https://codecov.io/gh/ml-libs/mlserve
.. image:: https://api.codeclimate.com/v1/badges/1ff813d5cad2d702cbf1/maintainability
:target: https://codeclimate.com/github/ml-libs/mlserve/maintainability
:alt: Maintainability
.. image:: https://img.shields.io/pypi/v/mlserve.svg
:target: https://pypi.python.org/pypi/mlserve**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.* https://young-ridge-56019.herokuapp.com
Full source code and instructions available here: https://github.com/ml-libs/mlserve-demo
.. image:: https://raw.githubusercontent.com/ml-libs/mlserve/master/docs/_static/list_models.png
:alt: mlserve models.. image:: https://raw.githubusercontent.com/ml-libs/mlserve/master/docs/_static/one_model.png
:alt: one modelIdeas
-----
**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/ml-libs/mlserve.git
Example
=======To deploy model just follow following simple steps:
Save your model into pickle file:
.. code:: python
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:.. code:: python
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 columnServe 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/predictUI is available via http://127.0.0.1:9000
Supported Frameworks
====================
* Scikit-Learn
* Keras (planning)
* PyTorch (planning)Requirements
------------* Python_ 3.6+
* aiohttp_.. _PEP492: https://www.python.org/dev/peps/pep-0492/
.. _Python: https://www.python.org
.. _aiohttp: https://github.com/aio-libs/aiohttp
.. _asyncio: http://docs.python.org/3.6/library/asyncio.html
.. _uvloop: https://github.com/MagicStack/uvloop