From 6e5a82bc0b01a42f3ac8041f25ad50292b38344a Mon Sep 17 00:00:00 2001 From: Yakov Goldberg Date: Mon, 17 Jun 2019 11:59:29 -0700 Subject: [PATCH] Add zero check for a value When running sklearn restful serving as standalone component _total_confidence_metric is None object, as it is not configured with the configure() which is called from deputy. --- .../restful_sklearn_serving/sklearn_restful_serving.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/components/Python/RestModelServing/restful_sklearn_serving/sklearn_restful_serving.py b/components/Python/RestModelServing/restful_sklearn_serving/sklearn_restful_serving.py index 306fd29..93ef414 100644 --- a/components/Python/RestModelServing/restful_sklearn_serving/sklearn_restful_serving.py +++ b/components/Python/RestModelServing/restful_sklearn_serving/sklearn_restful_serving.py @@ -218,7 +218,8 @@ def predict(self, url_params, form_params): .format(pred_probs, pred_index, prediction, prediction_confidence)) # Total confidence - self._total_confidence_metric.increase(prediction_confidence) + if self._total_confidence_metric: + self._total_confidence_metric.increase(prediction_confidence) if self._num_predictable_classes: # Prediction confidence per class