Commit
·
b03d3fc
1
Parent(s):
2854cf6
Update parquet files
Browse files- images.tar.gz → default/image-upoload-train.parquet +2 -2
- hf-imagetext.py +0 -37
- image-upoload.py +0 -59
images.tar.gz → default/image-upoload-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:3a1de4efd4c62968df042d9a9934a27ca4917ab985d529588574bc382935483d
|
3 |
+
size 180562
|
hf-imagetext.py
DELETED
@@ -1,37 +0,0 @@
|
|
1 |
-
import json
|
2 |
-
import datasets
|
3 |
-
|
4 |
-
_URL="https://huggingface.co/datasets/aadhiya/image-upoload/resolve/main/images.tar.gz"
|
5 |
-
class Builddata(datasets.GeneratorBasedBuilder):
|
6 |
-
def _info(self):
|
7 |
-
return datasets.DatasetInfo(
|
8 |
-
description=_DESCRIPTION,
|
9 |
-
features=datasets.Features(
|
10 |
-
{
|
11 |
-
"text":datasets.Value("string"),
|
12 |
-
"image":datasets.Image(),
|
13 |
-
}
|
14 |
-
),
|
15 |
-
supervised_keys=None
|
16 |
-
)
|
17 |
-
def _split_generators(self,dl_manager):
|
18 |
-
path=dl_manager.download(_URL)
|
19 |
-
image_iters=dl_manager.iter_archive(path)
|
20 |
-
return [
|
21 |
-
datasets.SplitGenerator(
|
22 |
-
name=datasets.Split.TRAIN,
|
23 |
-
gen_kwargs={
|
24 |
-
"images":image_iters
|
25 |
-
}
|
26 |
-
),
|
27 |
-
]
|
28 |
-
|
29 |
-
|
30 |
-
def _generate_examples(self,images):
|
31 |
-
idx=0
|
32 |
-
for filepath,image in images:
|
33 |
-
yield idx,{
|
34 |
-
"image":{"path":filepath,"bytes":image.read()},
|
35 |
-
"text":descriptions[idx]
|
36 |
-
}
|
37 |
-
idx+=1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
image-upoload.py
DELETED
@@ -1,59 +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/jamescalam/image-text-demo"
|
15 |
-
|
16 |
-
_LICENSE = ""
|
17 |
-
_URL="https://huggingface.co/datasets/aadhiya/image-upoload/resolve/main/images.tar.gz"
|
18 |
-
_REPO = "https://huggingface.co/datasets/jamescalam/image-text-demo"
|
19 |
-
descriptions=['Botpeg Singing','Botpeg Thinking','Botpeg Dancing']
|
20 |
-
|
21 |
-
class ImageSet(datasets.GeneratorBasedBuilder):
|
22 |
-
"""Small sample of image-text pairs"""
|
23 |
-
|
24 |
-
def _info(self):
|
25 |
-
return datasets.DatasetInfo(
|
26 |
-
description=_DESCRIPTION,
|
27 |
-
features=datasets.Features(
|
28 |
-
{
|
29 |
-
'text': datasets.Value("string"),
|
30 |
-
'image': datasets.Image(),
|
31 |
-
}
|
32 |
-
),
|
33 |
-
supervised_keys=None,
|
34 |
-
homepage=_HOMEPAGE,
|
35 |
-
citation=_CITATION,
|
36 |
-
)
|
37 |
-
|
38 |
-
def _split_generators(self, dl_manager):
|
39 |
-
path=dl_manager.download(_URL)
|
40 |
-
image_iters=dl_manager.iter_archive(path)
|
41 |
-
return [
|
42 |
-
datasets.SplitGenerator(
|
43 |
-
name=datasets.Split.TRAIN,
|
44 |
-
gen_kwargs={
|
45 |
-
"images": image_iters
|
46 |
-
}
|
47 |
-
),
|
48 |
-
]
|
49 |
-
|
50 |
-
def _generate_examples(self, images):
|
51 |
-
""" This function returns the examples in the raw (text) form."""
|
52 |
-
idx=0
|
53 |
-
for filepath,image in images:
|
54 |
-
yield idx,{
|
55 |
-
"image":{"path":filepath,"bytes":image.read()},
|
56 |
-
"text":descriptions[idx]
|
57 |
-
}
|
58 |
-
idx+=1
|
59 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|