diff --git a/requirements.txt b/requirements.txt index 7a2fbcc..6eca7ec 100644 --- a/requirements.txt +++ b/requirements.txt @@ -33,3 +33,4 @@ scipy dash-extensions==1.0.1 dash-bootstrap-components==1.5.0 dash_auth==2.0.0 +canonicaljson diff --git a/utils/annotations.py b/utils/annotations.py index 6978c5f..c2eafcd 100644 --- a/utils/annotations.py +++ b/utils/annotations.py @@ -1,8 +1,8 @@ import hashlib import io -import json import zipfile +import canonicaljson import numpy as np import scipy.sparse as sp from matplotlib.path import Path @@ -62,8 +62,8 @@ def get_annotation_classes(self): def get_annotations_hash(self): hash_object = hashlib.md5() - hash_object.update(json.dumps(self.annotations, sort_keys=True).encode()) - hash_object.update(json.dumps(self.annotation_classes, sort_keys=True).encode()) + hash_object.update(canonicaljson.encode_canonical_json(self.annotations)) + hash_object.update(canonicaljson.encode_canonical_json(self.annotation_classes)) return hash_object.hexdigest() def get_annotation_mask_as_bytes(self):