Skip to main content

Deserve is a nanoframework for serving ML models

Project description

Deserve

Deserve is a nanoframework for serving ML models. Flasker than Flask, faster than FastAPI, Deserve is asynchronous, lightweight and simple.

Features

  • 🤙 Remote procedure call (RPC) architecture. There are no endpoints, methods, paths, nor resource to make decisions about — just the host:port.
  • 📦 Send JSON, receive JSON. Accept a Python object, return an object. Conversions happen under the hood.

Installing

$ pip install deserve

Also install an ASGI server such as Uvicorn or Hypercorn.

$ pip install hypercorn

Quickstart

# Save this as example.py
import deserve

model = ... # Load your model

@deserve
async def predict(request: object) -> object:
  ... # Preprocess input
  output = model.predict(input)
  ... # Postprocess output
  return response

Run the server using the names of your file (example.py) and function (predict).

$ hypercorn server:predict

[INFO] Running on http://127.0.0.1:8000

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

deserve-0.1.tar.gz (4.0 kB view hashes)

Uploaded Source

Built Distribution

deserve-0.1-py2.py3-none-any.whl (3.0 kB view hashes)

Uploaded Python 2 Python 3

Supported by

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