ersilia-os / ersilia-pack

Module to pack Ersilia models with FastAPI
GNU General Public License v3.0
2 stars 6 forks source link

Ersilia Packaging Based on FastAPI

Given an Ersilia model repository, this package allows you to serve it using FastAPI.

Installation

pip install git+https://github.com/ersilia-os/ersilia-pack.git

Usage

You can check that the model repository contains all the expected files as follows:

ersilia_model_lint --repo_path $REPO_PATH

You can pack models that either require conda install or only pip installs, or both:

ersilia_model_pack --repo_path $REPO_PATH --bundles_repo_path $BUNDLE_PATH

If there are conda dependencies within the provided install instructions, the command above will install them in the base conda environment. To install conda dependencies in a specific conda environment, modify the above command as follows:

ersilia_model_pack --repo_path $REPO_PATH --bundles_repo_path $BUNDLE_PATH --conda_env_name $CONDA_ENV

This will create a folder with the packed model and the app available. The app can be served as follows:

ersilia_model_serve --bundle_path $BUNDLE_PATH --port $PORT

API

The FastAPI APIs are divided into two blocks: Metadata and App. Generally, Metadata includes GET requests, and App includes POST requests.

Metadata

App

Output Orientation

Outputs are always provided in JSON format. We use the orient syntax from Pandas, including:

For Developers