Susmita1302 commited on
Commit
42c9480
·
verified ·
1 Parent(s): f5f16f2

Delete sample_data.py

Browse files
Files changed (1) hide show
  1. sample_data.py +0 -61
sample_data.py DELETED
@@ -1,61 +0,0 @@
1
- import datasets
2
-
3
- _CITATION = """\
4
- @InProceedings{huggingface:dataset,
5
- title = {Small image-text set},
6
- author={James Briggs},
7
- year={2022}
8
- }
9
- """
10
-
11
- _DESCRIPTION = """\
12
- Demo dataset for testing or showing image-text capabilities.
13
- """
14
-
15
- _URL = "https://huggingface.co/datasets/Susmita1302/Text-to-Image/resolve/main/images%20(2)%20(1).tar.gz?download=true"
16
-
17
- _HOMEPAGE = "https://huggingface.co/datasets/Susmita1302/sample_data_images"
18
-
19
- _LICENSE = ""
20
-
21
- _REPO = "https://huggingface.co/datasets/Susmita1302/sample_data_images"
22
-
23
- class ImageSet(datasets.GeneratorBasedBuilder):
24
- """Small sample of image-text pairs"""
25
-
26
- def _info(self):
27
- return datasets.DatasetInfo(
28
- description=_DESCRIPTION,
29
- features=datasets.Features(
30
- {
31
- 'text': datasets.Value("string"),
32
- 'image': datasets.Image(),
33
- }
34
- ),
35
- supervised_keys=None,
36
- homepage=_HOMEPAGE,
37
- citation=_CITATION,
38
- )
39
-
40
- def _split_generators(self, dl_manager):
41
- images_archive = dl_manager.download(f"{_REPO}/resolve/main/images.tgz")
42
- image_iters = dl_manager.iter_archive(images_archive)
43
- return [
44
- datasets.SplitGenerator(
45
- name=datasets.Split.TRAIN,
46
- gen_kwargs={
47
- "images": image_iters
48
- }
49
- ),
50
- ]
51
-
52
- def _generate_examples(self, images):
53
- """ This function returns the examples in the raw (text) form."""
54
-
55
- for idx, (filepath, image) in enumerate(images):
56
- description = filepath.split('/')[-1][:-4]
57
- description = description.replace('_', ' ')
58
- yield idx, {
59
- "image": {"path": filepath, "bytes": image.read()},
60
- "text": description,
61
- }