Spaces:
Paused
Paused
update the downloader
Browse files
app.py
CHANGED
@@ -18,6 +18,9 @@ import torch
|
|
18 |
import torchvision
|
19 |
from huggingface_hub import HfApi, login, snapshot_download
|
20 |
from PIL import Image
|
|
|
|
|
|
|
21 |
|
22 |
# session_token = os.environ.get("SessionToken")
|
23 |
# login(token=session_token)
|
@@ -66,9 +69,12 @@ imagenet_hard = datasets.load_dataset("taesiri/imagenet-hard", split="validation
|
|
66 |
|
67 |
|
68 |
def update_snapshot(username):
|
|
|
|
|
|
|
69 |
output_dir = snapshot_download(
|
70 |
repo_id="taesiri/imagenet_hard_review_data",
|
71 |
-
allow_patterns=
|
72 |
repo_type="dataset",
|
73 |
)
|
74 |
files = glob(f"{output_dir}/*.json")
|
|
|
18 |
import torchvision
|
19 |
from huggingface_hub import HfApi, login, snapshot_download
|
20 |
from PIL import Image
|
21 |
+
import re
|
22 |
+
from fnmatch import translate
|
23 |
+
|
24 |
|
25 |
# session_token = os.environ.get("SessionToken")
|
26 |
# login(token=session_token)
|
|
|
69 |
|
70 |
|
71 |
def update_snapshot(username):
|
72 |
+
escaped_username = re.escape(username)
|
73 |
+
pattern = f"*{escaped_username}*.json"
|
74 |
+
|
75 |
output_dir = snapshot_download(
|
76 |
repo_id="taesiri/imagenet_hard_review_data",
|
77 |
+
allow_patterns=translate(pattern),
|
78 |
repo_type="dataset",
|
79 |
)
|
80 |
files = glob(f"{output_dir}/*.json")
|