AdamOswald1
commited on
Commit
•
c16b786
1
Parent(s):
fbe01e5
Upload 2 files
Browse files
datasets/animelover/genshin-impact-images/genshin-impact-images.py
ADDED
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import os
|
2 |
+
import datasets
|
3 |
+
from huggingface_hub import HfApi
|
4 |
+
from datasets import DownloadManager, DatasetInfo
|
5 |
+
from datasets.data_files import DataFilesDict
|
6 |
+
|
7 |
+
_EXTENSION = [".png", ".jpg", ".jpeg"]
|
8 |
+
_DESCRIPTION = ""
|
9 |
+
_NAME = "animelover/genshin-impact-images"
|
10 |
+
_REVISION = "main"
|
11 |
+
|
12 |
+
|
13 |
+
class DanbooruDataset(datasets.GeneratorBasedBuilder):
|
14 |
+
|
15 |
+
def _info(self) -> DatasetInfo:
|
16 |
+
return datasets.DatasetInfo(
|
17 |
+
description=_DESCRIPTION,
|
18 |
+
features=datasets.Features(
|
19 |
+
{
|
20 |
+
"image": datasets.Image(),
|
21 |
+
"tags": datasets.Value("string")
|
22 |
+
}
|
23 |
+
),
|
24 |
+
supervised_keys=None,
|
25 |
+
citation="",
|
26 |
+
)
|
27 |
+
|
28 |
+
def _split_generators(self, dl_manager: DownloadManager):
|
29 |
+
hfh_dataset_info = HfApi().dataset_info(_NAME, revision=_REVISION, timeout=100.0)
|
30 |
+
data_files = DataFilesDict.from_hf_repo(
|
31 |
+
{datasets.Split.TRAIN: ["**"]},
|
32 |
+
dataset_info=hfh_dataset_info,
|
33 |
+
allowed_extensions=["zip"],
|
34 |
+
)
|
35 |
+
gs = []
|
36 |
+
for split, files in data_files.items():
|
37 |
+
downloaded_files = dl_manager.download_and_extract(files)
|
38 |
+
gs.append(datasets.SplitGenerator(name=split, gen_kwargs={"filepath": downloaded_files}))
|
39 |
+
return gs
|
40 |
+
|
41 |
+
def _generate_examples(self, filepath):
|
42 |
+
for path in filepath:
|
43 |
+
all_fnames = {os.path.relpath(os.path.join(root, fname), start=path)
|
44 |
+
for root, _dirs, files in os.walk(path) for fname in files}
|
45 |
+
image_fnames = sorted(fname for fname in all_fnames
|
46 |
+
if os.path.splitext(fname)[1].lower() in _EXTENSION)
|
47 |
+
for image_fname in image_fnames:
|
48 |
+
image_path = os.path.join(path, image_fname)
|
49 |
+
tags_path = os.path.join(path, os.path.splitext(image_fname)[0] + ".txt")
|
50 |
+
with open(tags_path, "r", encoding="utf-8") as f:
|
51 |
+
tags = f.read()
|
52 |
+
yield image_fname, {"image": image_path, "tags": tags}
|
datasets/animelover/genshin-impact-images/gitattributes.txt
ADDED
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
*.7z filter=lfs diff=lfs merge=lfs -text
|
2 |
+
*.arrow filter=lfs diff=lfs merge=lfs -text
|
3 |
+
*.bin filter=lfs diff=lfs merge=lfs -text
|
4 |
+
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
5 |
+
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
6 |
+
*.ftz filter=lfs diff=lfs merge=lfs -text
|
7 |
+
*.gz filter=lfs diff=lfs merge=lfs -text
|
8 |
+
*.h5 filter=lfs diff=lfs merge=lfs -text
|
9 |
+
*.joblib filter=lfs diff=lfs merge=lfs -text
|
10 |
+
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
11 |
+
*.lz4 filter=lfs diff=lfs merge=lfs -text
|
12 |
+
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
13 |
+
*.model filter=lfs diff=lfs merge=lfs -text
|
14 |
+
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
15 |
+
*.npy filter=lfs diff=lfs merge=lfs -text
|
16 |
+
*.npz filter=lfs diff=lfs merge=lfs -text
|
17 |
+
*.onnx filter=lfs diff=lfs merge=lfs -text
|
18 |
+
*.ot filter=lfs diff=lfs merge=lfs -text
|
19 |
+
*.parquet filter=lfs diff=lfs merge=lfs -text
|
20 |
+
*.pb filter=lfs diff=lfs merge=lfs -text
|
21 |
+
*.pickle filter=lfs diff=lfs merge=lfs -text
|
22 |
+
*.pkl filter=lfs diff=lfs merge=lfs -text
|
23 |
+
*.pt filter=lfs diff=lfs merge=lfs -text
|
24 |
+
*.pth filter=lfs diff=lfs merge=lfs -text
|
25 |
+
*.rar filter=lfs diff=lfs merge=lfs -text
|
26 |
+
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
27 |
+
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
28 |
+
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
29 |
+
*.tflite filter=lfs diff=lfs merge=lfs -text
|
30 |
+
*.tgz filter=lfs diff=lfs merge=lfs -text
|
31 |
+
*.wasm filter=lfs diff=lfs merge=lfs -text
|
32 |
+
*.xz filter=lfs diff=lfs merge=lfs -text
|
33 |
+
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
+
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
+
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
36 |
+
# Audio files - uncompressed
|
37 |
+
*.pcm filter=lfs diff=lfs merge=lfs -text
|
38 |
+
*.sam filter=lfs diff=lfs merge=lfs -text
|
39 |
+
*.raw filter=lfs diff=lfs merge=lfs -text
|
40 |
+
# Audio files - compressed
|
41 |
+
*.aac filter=lfs diff=lfs merge=lfs -text
|
42 |
+
*.flac filter=lfs diff=lfs merge=lfs -text
|
43 |
+
*.mp3 filter=lfs diff=lfs merge=lfs -text
|
44 |
+
*.ogg filter=lfs diff=lfs merge=lfs -text
|
45 |
+
*.wav filter=lfs diff=lfs merge=lfs -text
|
46 |
+
# Image files - uncompressed
|
47 |
+
*.bmp filter=lfs diff=lfs merge=lfs -text
|
48 |
+
*.gif filter=lfs diff=lfs merge=lfs -text
|
49 |
+
*.png filter=lfs diff=lfs merge=lfs -text
|
50 |
+
*.tiff filter=lfs diff=lfs merge=lfs -text
|
51 |
+
# Image files - compressed
|
52 |
+
*.jpg filter=lfs diff=lfs merge=lfs -text
|
53 |
+
*.jpeg filter=lfs diff=lfs merge=lfs -text
|
54 |
+
*.webp filter=lfs diff=lfs merge=lfs -text
|