Skip to main content
Python Software Foundation 20th Year Anniversary Fundraiser  Donate today!

AsyncIO serving for data science models

Project description


Code style: black License Build Status Build status PyPI codecov

AsyncIO serving for data science models built on Starlette

Requirements: Python 3.6.1+

Quick Start

Installation using pip:

pip install foxcross

Create some test data and a simple model in the same directory to be served:

directory structure

+-- data.json



from foxcross.serving import ModelServing, run_model_serving

class AddOneModel(ModelServing):
    test_data_path = "data.json"

    def predict(self, data):
        return [x + 1 for x in data]

if __name__ == "__main__":

Run the model locally


Navigate to localhost:8000/predict-test/ in your web browser, and you should see the list incremented by 1. You can visit localhost:8000/ to see all the available endpoints for your model.

Why does this package exist?

Currently, some of the most popular data science model building frameworks such as PyTorch and Scikit-Learn do not come with a built in serving library similar to TensorFlow Serving.

To fill this gap, people create Flask applications to serve their model. This can be error prone, and the implementation can differ between each model. Additionally, Flask is a WSGI web framework whereas Foxcross is built on Starlette, a more performant ASGI web framework.

Foxcross aims to be the serving library for data science models built with frameworks that do not come with their own serving library. Using Foxcross enables consistent and testable serving of data science models.


If you believe you've found a bug with security implications, please do not disclose this issue in a public forum.

Email us at

Project details

Download files

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

Files for foxcross, version 0.10.0
Filename, size File type Python version Upload date Hashes
Filename, size foxcross-0.10.0-py3-none-any.whl (13.9 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size foxcross-0.10.0.tar.gz (11.8 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page