This Page

Models holder class

class models.modelsHolder.ModelsHolderClass(models_directory)[source]

Class that loads and holds in memory all models for further predictions.

Attributes:
__configParser : ConfigParser()

Instance of config parser for loading configs that come with models.

__config : dict

Dictionary that contains entries of configs of every model. {‘model_no_1’ : {‘arg’:1, ‘arg2’:2}}

__models : list

List of strings with model names to load.

__model_instance_holder : dict

A dictionary containing instances of per-model specific classes (inheriting from the base ModelController class)

Methods

sendRequest(model_name, data) Invokes the ModelController’s feed method that returns models prediction.
getAvailableModels() Returns loaded and available models.
getModelsConfigs() Get all models configs.
getAvailableModels()[source]

Returns loaded and available models.

getModelsConfigs()[source]

Get all models configs.

Returns:
dict
sendRequest(model_name, data)[source]

Invokes the ModelController’s feed method that returns models prediction.

Parameters:
model_name : str

Name of the model to use.

data : MultiDict or str

Data sent by the client to pass to the ModelController.

Returns:
str

Printable string ready to view / send to client. Prediction results or error message.