Buckets:
| import os | |
| from pathlib import Path | |
| import datasets | |
| _DESCRIPTION = """\ | |
| Captcha images dataset. | |
| """ | |
| _LICENSE = "wtfpl" | |
| _DATA_DIR = "data" | |
| class Captcha(datasets.GeneratorBasedBuilder): | |
| def _info(self): | |
| return datasets.DatasetInfo( | |
| description=_DESCRIPTION, | |
| features=datasets.Features( | |
| { | |
| "image": datasets.Image(), | |
| "solution": datasets.Value("string"), | |
| } | |
| ), | |
| license=_LICENSE, | |
| ) | |
| def _split_generators(self, dl_manager): | |
| return [ | |
| datasets.SplitGenerator( | |
| name=datasets.Split.TRAIN, | |
| gen_kwargs={ | |
| "images": dl_manager.iter_archive(dl_manager.download(os.path.join(_DATA_DIR, "train.tar.gz"))), | |
| }, | |
| ), | |
| datasets.SplitGenerator( | |
| name=datasets.Split.VALIDATION, | |
| gen_kwargs={ | |
| "images": dl_manager.iter_archive(dl_manager.download(os.path.join(_DATA_DIR, "validation.tar.gz"))), | |
| }, | |
| ), | |
| datasets.SplitGenerator( | |
| name=datasets.Split.TEST, | |
| gen_kwargs={ | |
| "images": dl_manager.iter_archive(dl_manager.download(os.path.join(_DATA_DIR, "test.tar.gz"))), | |
| }, | |
| ), | |
| ] | |
| def _generate_examples(self, images): | |
| for file_path, file_obj in images: | |
| yield file_path, { | |
| "image": {"path": file_path, "bytes": file_obj.read()}, | |
| "solution": Path(file_path).name.split('.')[0], | |
| } | |
Xet Storage Details
- Size:
- 1.67 kB
- Xet hash:
- 04a8df067689572e77a3f514de0c812bbe0fd4cbdac91bfddb54c28253d98dc5
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.