Peter / Peter.py
Stanislav Kalinin
chore: Update dataset_infos.json
c5a2483
raw
history blame
924 Bytes
import os
import datasets
class Peter(datasets.GeneratorBasedBuilder):
def _info(self):
return datasets.DatasetInfo(
features=datasets.Features(
{
"image": datasets.Image(),
}
)
)
def _split_generators(self, dl_manager):
DL_URLS = [
"images.zip"
]
data_files = dl_manager.download_and_extract(DL_URLS)
return [
datasets.SplitGenerator(
name=datasets.Split.TRAIN,
gen_kwargs={
"image_paths": dl_manager.iter_files(data_files),
},
),
]
def _generate_examples(self, image_paths):
"""Generate examples."""
for idx, image_path in enumerate(image_paths):
example = {
"image": image_path,
}
yield idx, example