animelover
commited on
Commit
·
f475e05
1
Parent(s):
569f522
Update touhou-images.py
Browse files- touhou-images.py +13 -4
touhou-images.py
CHANGED
@@ -1,8 +1,13 @@
|
|
1 |
import os
|
2 |
import datasets
|
|
|
3 |
from datasets import DownloadManager, DatasetInfo
|
|
|
4 |
|
5 |
_EXTENSION = [".png", ".jpg", ".jpeg"]
|
|
|
|
|
|
|
6 |
|
7 |
class DanbooruDataset(datasets.GeneratorBasedBuilder):
|
8 |
BUILDER_CONFIGS = [
|
@@ -42,10 +47,14 @@ class DanbooruDataset(datasets.GeneratorBasedBuilder):
|
|
42 |
)
|
43 |
|
44 |
def _split_generators(self, dl_manager: DownloadManager):
|
45 |
-
|
46 |
-
|
|
|
|
|
|
|
|
|
47 |
gs = []
|
48 |
-
for split, files in
|
49 |
downloaded_files = dl_manager.download_and_extract(files)
|
50 |
gs.append(datasets.SplitGenerator(name=split, gen_kwargs={"filepath": downloaded_files}))
|
51 |
return gs
|
@@ -71,4 +80,4 @@ class DanbooruDataset(datasets.GeneratorBasedBuilder):
|
|
71 |
|
72 |
|
73 |
nsfw_tags = ["nude", "completely nude", "topless", "bottomless", "sex", "oral", "fellatio gesture", "tentacle sex",
|
74 |
-
"nipples", "pussy", "vaginal", "pubic hair", "anus", "ass focus", "penis", "cum", "condom", "sex toy"]
|
|
|
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 |
+
_NAME = "animelover/touhou-images"
|
9 |
+
_REVISION = "main"
|
10 |
+
|
11 |
|
12 |
class DanbooruDataset(datasets.GeneratorBasedBuilder):
|
13 |
BUILDER_CONFIGS = [
|
|
|
47 |
)
|
48 |
|
49 |
def _split_generators(self, dl_manager: DownloadManager):
|
50 |
+
hfh_dataset_info = HfApi().dataset_info(_NAME, revision=_REVISION, timeout=100.0)
|
51 |
+
data_files = DataFilesDict.from_hf_repo(
|
52 |
+
{datasets.Split.TRAIN: ["**"]},
|
53 |
+
dataset_info=hfh_dataset_info,
|
54 |
+
allowed_extensions=["zip"],
|
55 |
+
)
|
56 |
gs = []
|
57 |
+
for split, files in data_files.items():
|
58 |
downloaded_files = dl_manager.download_and_extract(files)
|
59 |
gs.append(datasets.SplitGenerator(name=split, gen_kwargs={"filepath": downloaded_files}))
|
60 |
return gs
|
|
|
80 |
|
81 |
|
82 |
nsfw_tags = ["nude", "completely nude", "topless", "bottomless", "sex", "oral", "fellatio gesture", "tentacle sex",
|
83 |
+
"nipples", "pussy", "vaginal", "pubic hair", "anus", "ass focus", "penis", "cum", "condom", "sex toy"]
|