pycaret.regression.create_api#

pycaret.regression.create_api(estimator, api_name: str, host: str = '127.0.0.1', port: int = 8000) None[source]#

This function takes an input estimator and creates a POST API for inference. It only creates the API and doesn’t run it automatically. To run the API, you must run the Python file using !python.

Example

>>> from pycaret.datasets import get_data
>>> boston = get_data('boston')
>>> from pycaret.regression import *
>>> exp_name = setup(data = boston,  target = 'medv')
>>> lr = create_model('lr')
>>> create_api(lr, 'lr_api')
>>> !python lr_api.py #to run the API
estimator: scikit-learn compatible object

Trained model object

api_name: str

Name of the api as a string.

host: str, default = ‘127.0.0.1’

API host address.

port: int, default = 8000

port for API.

Returns:

None