pycaret.classification.create_api#

pycaret.classification.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
>>> juice = get_data('juice')
>>> from pycaret.classification import *
>>> exp_name = setup(data = juice,  target = 'Purchase')
>>> lr = create_model('lr')
>>> create_api(lr, 'lr_api'
>>> !python lr_api.py
estimator: scikit-learn compatible object

Trained model object

api_name: scikit-learn compatible object

Trained model object

host: str, default = ‘127.0.0.1’

API host address.

port: int, default = 8000

port for API.

Returns:

None