Model gabarit
This module contains a ModelGabarit class you can use for your gabarit generated projects
ModelGabarit
Bases: Model
Model class for a Gabarit generated project
- download_model has been redefined to download a model from artifactory based on the settings : ARTIFACTORY_MODEL_URL, ARTIFACTORY_USER, ARTIFACTORY_PASSWORD
- _load_model has been redefined to use utils_models.load_model
- predict has been redefined to use utils_models.predict
Source code in template_api/model/model_gabarit.py
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 |
|
__init__(*args, **kwargs)
Object initialization By default, it initialize the attributes _model, _model_config and _loaded
see the parent init method in template_api.model.model_base.Model
Source code in template_api/model/model_gabarit.py
download_model(**kwargs)
staticmethod
Download the model from an JFrog Artifactory repository
Source code in template_api/model/model_gabarit.py
explain_as_html(content, *args, **kwargs)
Compute explanations about a prediction and return an HTML report
Source code in template_api/model/model_gabarit.py
explain_as_json(content, *args, **kwargs)
Compute explanations about a prediction and return a JSON serializable object
Source code in template_api/model/model_gabarit.py
predict(content, *args, **kwargs)
Make a prediction by calling utils_models.predict with the loaded model
Source code in template_api/model/model_gabarit.py
ModelSettings
Bases: BaseSettings
Download settings
This class is used for settings management purpose, have a look at the pydantic documentation for more details : https://pydantic-docs.helpmanual.io/usage/settings/
By default, it looks for environment variables (case insensitive) to set the settings if a variable is not found, it looks for a file name .env in your working directory where you can declare the values of the variables and finally it sets the values to the default ones you can see above.