diff --git a/cnn_classification_service/magic_doer.py b/cnn_classification_service/magic_doer.py index de61036..2f225b5 100644 --- a/cnn_classification_service/magic_doer.py +++ b/cnn_classification_service/magic_doer.py @@ -3,6 +3,7 @@ import os import logging import tempfile import requests +import time from classifier_cache import ClassifierCache @@ -30,14 +31,17 @@ class MagicDoer: model_details, classifier = cls.classifier_cache.get_default_classifier() # do the majic + classification_start_time = time.time() predicted_class_name, labeled_predictions = classifier.predict(sample_file_path) + classification_duration = time.time() - classification_start_time response = { "tag": tag, "probability": labeled_predictions[model_details['target_class_name']], "all_predictions": labeled_predictions, "class": predicted_class_name, - "model": model_details['id'] + "model": model_details['id'], + "classification_duration": classification_duration } finally: