Initial commit.
Browse files- image_dummy.py +96 -0
- image_dummy.py.lock +0 -0
- lena.png +0 -0
- parrots.png +0 -0
- sample1.flac +0 -0
- tree.png +0 -0
image_dummy.py
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
|
| 16 |
+
|
| 17 |
+
import textwrap
|
| 18 |
+
|
| 19 |
+
import datasets
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
_CITATION = """\
|
| 23 |
+
"""
|
| 24 |
+
|
| 25 |
+
_DESCRIPTION = """\
|
| 26 |
+
"""
|
| 27 |
+
|
| 28 |
+
|
| 29 |
+
class ImageDummybConfig(datasets.BuilderConfig):
|
| 30 |
+
"""BuilderConfig for Superb."""
|
| 31 |
+
|
| 32 |
+
def __init__(
|
| 33 |
+
self,
|
| 34 |
+
data_url,
|
| 35 |
+
url,
|
| 36 |
+
task_templates=None,
|
| 37 |
+
**kwargs,
|
| 38 |
+
):
|
| 39 |
+
super(ImageDummybConfig, self).__init__(
|
| 40 |
+
version=datasets.Version("1.9.0", ""), **kwargs
|
| 41 |
+
)
|
| 42 |
+
self.data_url = data_url
|
| 43 |
+
self.url = url
|
| 44 |
+
self.task_templates = task_templates
|
| 45 |
+
|
| 46 |
+
|
| 47 |
+
class ImageDummy(datasets.GeneratorBasedBuilder):
|
| 48 |
+
"""Superb dataset."""
|
| 49 |
+
|
| 50 |
+
BUILDER_CONFIGS = [
|
| 51 |
+
ImageDummybConfig(
|
| 52 |
+
name="image",
|
| 53 |
+
description=textwrap.dedent(""),
|
| 54 |
+
url="",
|
| 55 |
+
data_url="",
|
| 56 |
+
)
|
| 57 |
+
]
|
| 58 |
+
|
| 59 |
+
DEFAULT_CONFIG_NAME = "image"
|
| 60 |
+
|
| 61 |
+
def _info(self):
|
| 62 |
+
return datasets.DatasetInfo(
|
| 63 |
+
description=_DESCRIPTION,
|
| 64 |
+
features=datasets.Features(
|
| 65 |
+
{
|
| 66 |
+
"id": datasets.Value("string"),
|
| 67 |
+
"file": datasets.Value("string"),
|
| 68 |
+
}
|
| 69 |
+
),
|
| 70 |
+
supervised_keys=("file",),
|
| 71 |
+
homepage=self.config.url,
|
| 72 |
+
citation=_CITATION,
|
| 73 |
+
)
|
| 74 |
+
|
| 75 |
+
def _split_generators(self, dl_manager):
|
| 76 |
+
DL_URLS = [
|
| 77 |
+
f"https://huggingface.co/datasets/Narsil/image_dummy/raw/main/{name}"
|
| 78 |
+
for name in ["lena.png", "parrots.png", "tree.png"]
|
| 79 |
+
]
|
| 80 |
+
archive_path = dl_manager.download_and_extract(DL_URLS)
|
| 81 |
+
return [
|
| 82 |
+
datasets.SplitGenerator(
|
| 83 |
+
name=datasets.Split.TEST,
|
| 84 |
+
gen_kwargs={"archive_path": archive_path},
|
| 85 |
+
),
|
| 86 |
+
]
|
| 87 |
+
|
| 88 |
+
def _generate_examples(self, archive_path):
|
| 89 |
+
"""Generate examples."""
|
| 90 |
+
for i, filename in enumerate(archive_path):
|
| 91 |
+
key = str(i)
|
| 92 |
+
example = {
|
| 93 |
+
"id": key,
|
| 94 |
+
"file": filename,
|
| 95 |
+
}
|
| 96 |
+
yield key, example
|
image_dummy.py.lock
ADDED
|
File without changes
|
lena.png
ADDED
|
parrots.png
ADDED
|
sample1.flac
ADDED
|
Binary file (94.3 kB). View file
|
|
|
tree.png
ADDED
|