Elron commited on
Commit
5901c08
·
verified ·
1 Parent(s): a3d663f

Upload utils.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. utils.py +6 -0
utils.py CHANGED
@@ -1,4 +1,5 @@
1
  import json
 
2
  from typing import Any, Dict
3
 
4
  import pkg_resources
@@ -27,6 +28,11 @@ def flatten_dict(
27
  return dict(items)
28
 
29
 
 
 
 
 
 
30
  def load_json(path):
31
  with open(path) as f:
32
  try:
 
1
  import json
2
+ from functools import lru_cache
3
  from typing import Any, Dict
4
 
5
  import pkg_resources
 
28
  return dict(items)
29
 
30
 
31
+ @lru_cache(maxsize=None)
32
+ def artifacts_json_cache(artifact_path):
33
+ return load_json(artifact_path)
34
+
35
+
36
  def load_json(path):
37
  with open(path) as f:
38
  try: