sk_serve package
Submodules
sk_serve.api module
- class sk_serve.api.SimpleAPI(pipeline_path: str, model_path: str, validation_model: BaseModel | None = None)[source]
Bases:
object
Simple API class that takes pipeline and model paths as arguments and defines one inference endpoint for simple model deployment. Both loaded object must be Scikit-learn objects. 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 two checks are made beforehand: check if the pipeline is a sklearn.compose.ColumnTransformer object & if the model loaded has predict method.
- Args:
inf_data (dict): Input data for inference. Currently only one data point at a time is supported.
- Raises:
RuntimeError: If the model loaded doesn’t have predict method.
- Returns:
dict: The prediction.