Spaces:
Paused
Paused
fix pattern
Browse files
app.py
CHANGED
@@ -18,6 +18,8 @@ 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 +68,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_r2",
|
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 |
session_token = os.environ.get("SessionToken")
|
25 |
login(token=session_token)
|
|
|
68 |
|
69 |
|
70 |
def update_snapshot(username):
|
71 |
+
escaped_username = re.escape(username)
|
72 |
+
pattern = f"*{escaped_username}*.json"
|
73 |
+
|
74 |
output_dir = snapshot_download(
|
75 |
repo_id="taesiri/imagenet_hard_review_data_r2",
|
76 |
+
allow_patterns=pattern,
|
77 |
repo_type="dataset",
|
78 |
)
|
79 |
files = glob(f"{output_dir}/*.json")
|