This Page

Model controller class

class models.modelController.ModelControllerClass(config, models_folder_path)[source]

Abstract class that every particular model-specific python file should inherit from in order to load the model.

Attributes:
__config : dict

Config loaded by ModelsControllerClass through ConfigParser

__model : Keras, Tensorflow or Pycharm format model

Loaded model

__models_folder_path : str

Path to folder containing config.ini of the model.

__model_name : str

Name of the loaded model.

Methods

load() Abstract method for loading models.
process_input_data(data) Abstract method for processing input data to predict.
get_formatted_prediction(prediction) Abstract method that returns beautified string to send to client
feed(data) Abstract method returning preformatted prediction on given data.
feed(data)[source]

Abstract method returning preformatted prediction on given data.

Parameters:
data : str or MultiDict

Data that comes from the client passed by ModelsHolder’s sendRequest method.

Returns:
str

Preformatted prediction

get_formatted_prediction(prediction)[source]

Abstract method that returns beautified string to send to client

Parameters:
prediction : predictions returned from the model
Returns:
str

pre-formatted string

load()[source]

Abstract method for loading models.

process_input_data(data)[source]

Abstract method for processing input data to predict.

Returns:
str

Models output.