Delete fixtures_image_utils.py
Browse files- fixtures_image_utils.py +0 -78
fixtures_image_utils.py
DELETED
@@ -1,78 +0,0 @@
|
|
1 |
-
# coding=utf-8
|
2 |
-
# Copyright 2021 The TensorFlow Datasets Authors and the HuggingFace Datasets Authors.
|
3 |
-
#
|
4 |
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
5 |
-
# you may not use this file except in compliance with the License.
|
6 |
-
# You may obtain a copy of the License at
|
7 |
-
#
|
8 |
-
# http://www.apache.org/licenses/LICENSE-2.0
|
9 |
-
#
|
10 |
-
# Unless required by applicable law or agreed to in writing, software
|
11 |
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
12 |
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13 |
-
# See the License for the specific language governing permissions and
|
14 |
-
# limitations under the License.
|
15 |
-
import textwrap
|
16 |
-
import datasets
|
17 |
-
_CITATION = """\\n"""
|
18 |
-
_DESCRIPTION = """\\n"""
|
19 |
-
class FixturesImageUtilsConfig(datasets.BuilderConfig):
|
20 |
-
"""BuilderConfig for fixtures ImageUtils"""
|
21 |
-
def __init__(
|
22 |
-
self,
|
23 |
-
data_url,
|
24 |
-
url,
|
25 |
-
task_templates=None,
|
26 |
-
**kwargs,
|
27 |
-
):
|
28 |
-
super(FixturesImageUtilsConfig, self).__init__(
|
29 |
-
version=datasets.Version("1.9.0", ""), **kwargs
|
30 |
-
)
|
31 |
-
self.data_url = data_url
|
32 |
-
self.url = url
|
33 |
-
self.task_templates = task_templates
|
34 |
-
class FixturesImageUtils(datasets.GeneratorBasedBuilder):
|
35 |
-
"""Fixtures for ImageUtils. Includes 1 image."""
|
36 |
-
BUILDER_CONFIGS = [
|
37 |
-
FixturesImageUtilsConfig(
|
38 |
-
name="image",
|
39 |
-
description=textwrap.dedent(""),
|
40 |
-
url="",
|
41 |
-
data_url="",
|
42 |
-
)
|
43 |
-
]
|
44 |
-
DEFAULT_CONFIG_NAME = "image"
|
45 |
-
def _info(self):
|
46 |
-
return datasets.DatasetInfo(
|
47 |
-
description=_DESCRIPTION,
|
48 |
-
features=datasets.Features(
|
49 |
-
{
|
50 |
-
"id": datasets.Value("string"),
|
51 |
-
"file": datasets.Value("string"),
|
52 |
-
}
|
53 |
-
),
|
54 |
-
supervised_keys=("file",),
|
55 |
-
homepage=self.config.url,
|
56 |
-
citation=_CITATION,
|
57 |
-
)
|
58 |
-
def _split_generators(self, dl_manager):
|
59 |
-
DL_URLS = [
|
60 |
-
f"https://huggingface.co/datasets/hf-internal-testing/fixtures_image_utils/raw/main/{name}"
|
61 |
-
for name in ["lena.png", "parrots.png", "tree.png", "cat-rotated.jpg", "cats.jpg", "selena.jpeg"]
|
62 |
-
]
|
63 |
-
archive_path = dl_manager.download_and_extract(DL_URLS)
|
64 |
-
return [
|
65 |
-
datasets.SplitGenerator(
|
66 |
-
name=datasets.Split.TEST,
|
67 |
-
gen_kwargs={"archive_path": archive_path},
|
68 |
-
),
|
69 |
-
]
|
70 |
-
def _generate_examples(self, archive_path):
|
71 |
-
"""Generate examples."""
|
72 |
-
for i, filename in enumerate(archive_path):
|
73 |
-
key = str(i)
|
74 |
-
example = {
|
75 |
-
"id": key,
|
76 |
-
"file": filename,
|
77 |
-
}
|
78 |
-
yield key, example
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|