sk_serve package

Submodules

sk_serve.api module

class sk_serve.api.SimpleAPI(pipeline_path: str, validation_model: type[BaseModel] | None = None)[source]

Bases: object

Simple API class that takes pipeline/model path as arguments and defines one inference endpoint for simple model deployment. The pipeline must be a Scikit-Learn Pipeline. It can also take a pydantic validation model as input in order to validate the input everytime inference is requested.

static home() Dict[str, str][source]

Method that returns a message when sending a GET request to the / endpoint.

inference(inf_data: dict)[source]

Inference method that is used by the inference endpoint. In order to get the prediction the deployed pipeline must have the predict method.

Args:

inf_data (dict): Input data for inference. Currently only one data point at a time is supported.

Returns:

dict: The prediction.

sk_serve.serve module

sk_serve.serve.serve(simple_api: SimpleAPI)[source]

Function that constructs the model API.

Args:

simple_api (SimpleAPI): The SimpleAPI object needed for deployment.

Returns:

app (FastAPI): The FastAPI application.