# Model Library (sklearn)

The following document will explain how to call the various functions implemented in the model library API for the iSee project, in particular we will describe the behaviour for the sklearn version.

Launching the API

The API can be executed in two ways depending if an storage path for the models is passed as a parameter or not:

Without an storage path

Requirements

Running the API

  1. A console must be opened in the directory containing the app.py file.
  2. Run the following command python app.py.
  3. The API should be running in a localhost and request can now be send.

Here's an example:

Run no path

With an storage path

Requirements

Running the API

  1. A console must be opened in the directory containing the app.py file.
  2. Run the following command python app.py "path". REMINDER: If the path contains spaces it must be written between quotation marks.
  3. The API should be running in a localhost and request can now be send.

Here's an example:

Run with path

Basic functions

Uploading a model

In order to upload a model to the API the function upload_model must be called in POST mode using the following parameters in the Body form-data section:

The function will return the id assigned to the model.

Here we have an example using Postman:

Uploading a model

Updating a model

In order to update an existing model to the API the function upload_model must be called in PUT mode using the following parameters in the Body form-data section:

The function will return a message confirming the update of the model.

Here we have an example using Postman:

Updating a model

Uploading a dataset

In order to upload a model to the API the function dataset must be called in POST mode using the following parameters in the Body form-data section:

The function will return a message confirming the upload of the dataset.

Here we have an example using Postman:

Uploading a dataset

Retrieve a dataset

In order to obtain the dataset used to train a model from the API the function dataset must be called in GET mode using the following parameters in the URL parameter section: - id: this field must contain the id of the model whose dataset we wish to retrieve.

The function will return the dataset associated with the id.

Here we have an example using Postman:

Downloading a dataset

Deleting a model

In order to delete an uploaded model from the API the function delete must be called in DELETE mode using the following parameters in the Body form-data section:

The function will return a message confirming the deletion.

Here we have an example using Postman:

Deleting a model

Retrieving a model's parameters

In order to retrieve the parameters provided when uploading a model to the API the function info must be called in GET mode using the following parameters in the URL parameter section:

The function will return a json with the parameters.

Here we have an example using Postman:

Retrieving a model's parameters

Predicting with an image

In order to make a prediction based on an image using a model uploaded to the API the function /Image/run must be called in POST mode using the following parameters in the Body form-data section:

The function will return a message with the model prediction.

Here we have an example using Postman:

Predicting an image

Predicting with a tabular set

In order to make a prediction based on a dataset using a model uploaded to the API the function /Tabular/run must be called in POST mode using the following parameters in the Body form-data section:

The function will return a message with the model prediction.

Here we have an example using Postman:

Predicting an image