Commit
·
d7020a2
1
Parent(s):
7dcef9f
Update parquet files
Browse files
images.tar.gz → default/image-test-train.parquet
RENAMED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:6fb0ea54b75342f36d81670a1a9b3dc38436c5a75daab71c35361e125da3dc4e
|
3 |
+
size 180539
|
image-test.py
DELETED
@@ -1,78 +0,0 @@
|
|
1 |
-
|
2 |
-
import datasets
|
3 |
-
|
4 |
-
_CITATION = """\
|
5 |
-
@InProceedings{huggingface:dataset,
|
6 |
-
title = {Small image-text set},
|
7 |
-
author={James Briggs},
|
8 |
-
year={2022}
|
9 |
-
}
|
10 |
-
"""
|
11 |
-
|
12 |
-
_DESCRIPTION = """\
|
13 |
-
Demo dataset for testing or showing image-text capabilities.
|
14 |
-
"""
|
15 |
-
_HOMEPAGE = "https://huggingface.co/datasets/jamescalam/image-text-demo"
|
16 |
-
|
17 |
-
_LICENSE = ""
|
18 |
-
_URL="https://huggingface.co/datasets/aadhiya/image-upoload/resolve/main/images.tar.gz"
|
19 |
-
_REPO = "https://huggingface.co/datasets/jamescalam/image-text-demo"
|
20 |
-
descriptions=[
|
21 |
-
"BotPeg Dance",
|
22 |
-
"BotPeg Dance",
|
23 |
-
"BotPeg Excited",
|
24 |
-
"BotPeg Excited",
|
25 |
-
"BotPeg Fight",
|
26 |
-
"BotPeg Funny",
|
27 |
-
"BotPeg Funny",
|
28 |
-
"BotPeg Funny",
|
29 |
-
"BotPeg Love",
|
30 |
-
"BotPeg Mad",
|
31 |
-
"BotPeg Sad",
|
32 |
-
"BotPeg Scared",
|
33 |
-
"BotPeg Shy",
|
34 |
-
"BotPeg Thinking",
|
35 |
-
"BotPeg Thinking",
|
36 |
-
"BotPeg Winner",
|
37 |
-
"BotPeg Worried",
|
38 |
-
]
|
39 |
-
|
40 |
-
class ImageSet(datasets.GeneratorBasedBuilder):
|
41 |
-
"""Small sample of image-text pairs"""
|
42 |
-
|
43 |
-
def _info(self):
|
44 |
-
return datasets.DatasetInfo(
|
45 |
-
description=_DESCRIPTION,
|
46 |
-
features=datasets.Features(
|
47 |
-
{
|
48 |
-
'text': datasets.Value("string"),
|
49 |
-
'image': datasets.Image(),
|
50 |
-
}
|
51 |
-
),
|
52 |
-
supervised_keys=None,
|
53 |
-
homepage=_HOMEPAGE,
|
54 |
-
citation=_CITATION,
|
55 |
-
)
|
56 |
-
|
57 |
-
def _split_generators(self, dl_manager):
|
58 |
-
path=dl_manager.download(_URL)
|
59 |
-
image_iters=dl_manager.iter_archive(path)
|
60 |
-
return [
|
61 |
-
datasets.SplitGenerator(
|
62 |
-
name=datasets.Split.TRAIN,
|
63 |
-
gen_kwargs={
|
64 |
-
"images": image_iters
|
65 |
-
}
|
66 |
-
),
|
67 |
-
]
|
68 |
-
|
69 |
-
def _generate_examples(self, images):
|
70 |
-
""" This function returns the examples in the raw (text) form."""
|
71 |
-
idx=0
|
72 |
-
for filepath,image in images:
|
73 |
-
yield idx,{
|
74 |
-
"image":{"path":filepath,"bytes":image.read()},
|
75 |
-
"text":descriptions[idx]
|
76 |
-
}
|
77 |
-
idx+=1
|
78 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|