Datasets:
Commit
•
b26f59b
1
Parent(s):
eb3ccf7
Remove script to generate dummy data
Browse files- fix_generated_dummy_data.py +0 -48
- huggingface.jpg +0 -0
fix_generated_dummy_data.py
DELETED
@@ -1,48 +0,0 @@
|
|
1 |
-
import json
|
2 |
-
import re
|
3 |
-
from pathlib import Path
|
4 |
-
from zipfile import ZipFile
|
5 |
-
|
6 |
-
|
7 |
-
def main():
|
8 |
-
dummy_dir = Path(__file__).parent / "dummy"
|
9 |
-
config_paths = list(dummy_dir.iterdir())
|
10 |
-
|
11 |
-
for config in config_paths:
|
12 |
-
versions = list(config.iterdir())
|
13 |
-
assert len(versions) == 1, versions
|
14 |
-
version = versions[0]
|
15 |
-
zip_filepath = version / "dummy_data.zip"
|
16 |
-
|
17 |
-
# We need to open the zip file
|
18 |
-
with ZipFile(zip_filepath, "r") as zip_dir:
|
19 |
-
with zip_dir.open("dummy_data/image_data.json.zip/image_data.json", "r") as fi:
|
20 |
-
image_metadatas = json.load(fi)
|
21 |
-
|
22 |
-
default_jpg_path = Path(__file__).parent / "huggingface.jpg"
|
23 |
-
with ZipFile(zip_filepath, "a") as zip_dir:
|
24 |
-
for image_metadata in image_metadatas:
|
25 |
-
url = image_metadata["url"]
|
26 |
-
|
27 |
-
matches = re.match(r"https://cs.stanford.edu/people/rak248/VG_100K(?:_(2))?/[0-9]+.jpg", url)
|
28 |
-
assert matches is not None
|
29 |
-
|
30 |
-
# Find where locally the images should be
|
31 |
-
vg_version = matches.group(1)
|
32 |
-
if vg_version is None:
|
33 |
-
local_path = re.sub(
|
34 |
-
"https://cs.stanford.edu/people/rak248/VG_100K", "dummy_data/images.zip/VG_100K", url
|
35 |
-
)
|
36 |
-
else:
|
37 |
-
local_path = re.sub(
|
38 |
-
f"https://cs.stanford.edu/people/rak248/VG_100K_{vg_version}",
|
39 |
-
f"dummy_data/images{vg_version}.zip/VG_100K_{vg_version}",
|
40 |
-
url,
|
41 |
-
)
|
42 |
-
|
43 |
-
# Write those images.
|
44 |
-
zip_dir.write(filename=default_jpg_path, arcname=local_path)
|
45 |
-
|
46 |
-
|
47 |
-
if __name__ == "__main__":
|
48 |
-
main()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
huggingface.jpg
DELETED
Binary file (656 Bytes)
|
|