predict

predict(endpoint, data: Union[dict, pd.DataFrame, pd.Series], **kw)

Make a prediction from model endpoint

Parameters

endpoint :

URI path to endpoint

data : Union[dict, pd.DataFrame, pd.Series]

New data for making predictions, such as a data frame.

Returns

: dict

Endpoint_name and list of endpoint_fx output

Examples

from vetiver import vetiver_endpoint, mock, predict
X, y = mock.get_mock_data()
endpoint = vetiver_endpoint(url='http://127.0.0.1:8000/predict')
predict(endpoint, X)

Notes

To authorize a request to Posit Connect, pass in a dictionary of headers that includes your API key. For example:

h = { 'Authorization': f'Key {api_key}' }
response = predict(data = data, endpoint = endpoint, headers=h)