module netrest.rest_helper

Short summary

module lightmlrestapi.netrest.rest_helper

Helpers to submit REST API requests.

source on GitHub

Functions

function

truncated documentation

json_predict_model

Builds a REST request to compute the prediction of a machine learning model upload with json_upload_model(). …

json_upload_model

Builds a REST request to upload a machine learned models to a REST API defined by MLStoragePost.

submit_rest_request

Submits a request to a REST API defined by MLStoragePost.

Documentation

Helpers to submit REST API requests.

source on GitHub

lightmlrestapi.netrest.rest_helper.json_predict_model(name, data, format='json')

Builds a REST request to compute the prediction of a machine learning model upload with json_upload_model. See also MLStoragePost.

Parameters:
  • name – name of the model, should be unique and not already used

  • data – any kind of data the model request

  • format'json' or 'image'

Returns:

dictionary ready to be jsonified

source on GitHub

lightmlrestapi.netrest.rest_helper.json_upload_model(name, pyfile, data=None)

Builds a REST request to upload a machine learned models to a REST API defined by MLStoragePost.

Parameters:
  • name – name of the model, should be unique and not already used

  • pyfile – python file which computes the prediction, the file must follows the specification defined in Templates

  • data – binary file, usually everything the models pickled

Returns:

dictionary ready to be jsonified

source on GitHub

lightmlrestapi.netrest.rest_helper.submit_rest_request(request, login=None, pwd=None, url='http://127.0.0.1:8081/', timeout=50, fLOG=None)

Submits a request to a REST API defined by MLStoragePost.

Parameters:
  • login – login

  • pwd – password

  • request – request as a dictionary

  • url – url

  • timeout – timeout

  • fLOG – logging function

Returns:

request results as dictionary

source on GitHub