danbrown commited on
Commit
b6cae0a
·
1 Parent(s): 3c21fb0

fixing script

Browse files
Files changed (2) hide show
  1. images.tar.gz +0 -3
  2. loading.py +0 -58
images.tar.gz DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:bc56b5d6c394ea1ff463ff9211f4af0cd4c441b8192f91eabbd9224e1120c1e5
3
- size 7660992
 
 
 
 
loading.py DELETED
@@ -1,58 +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
- _HOMEPAGE = "https://huggingface.co/datasets/danbrown/testman-dataset"
15
-
16
- _LICENSE = ""
17
-
18
- _REPO = "https://huggingface.co/datasets/danbrown/testman-dataset"
19
-
20
- class ImageSet(datasets.GeneratorBasedBuilder):
21
- """Small sample of image-text pairs"""
22
-
23
- def _info(self):
24
- return datasets.DatasetInfo(
25
- description=_DESCRIPTION,
26
- features=datasets.Features(
27
- {
28
- 'text': datasets.Value("string"),
29
- 'image': datasets.Image(),
30
- }
31
- ),
32
- supervised_keys=None,
33
- homepage=_HOMEPAGE,
34
- citation=_CITATION,
35
- )
36
-
37
- def _split_generators(self, dl_manager):
38
- images_archive = dl_manager.download(f"{_REPO}/resolve/main/images.tar.gz")
39
- image_iters = dl_manager.iter_archive(images_archive)
40
- return [
41
- datasets.SplitGenerator(
42
- name=datasets.Split.TRAIN,
43
- gen_kwargs={
44
- "images": image_iters
45
- }
46
- ),
47
- ]
48
-
49
- def _generate_examples(self, images):
50
- """ This function returns the examples in the raw (text) form."""
51
-
52
- for idx, (filepath, image) in enumerate(images):
53
- description = filepath.split('/')[-1][:-4]
54
- description = description.replace('_', ' ')
55
- yield idx, {
56
- "image": {"path": filepath, "bytes": image.read()},
57
- "text": description,
58
- }