Update Image-demo.py
Browse files- Image-demo.py +4 -0
Image-demo.py
CHANGED
@@ -17,6 +17,7 @@ _HOMEPAGE = "https://huggingface.co/datasets/ppp121386/Image-demo"
|
|
17 |
_LICENSE = ""
|
18 |
|
19 |
_REPO_URL = "https://huggingface.co/datasets/ppp121386/Image-demo/resolve/main/images.tar.gz"
|
|
|
20 |
|
21 |
# _CAPTION = ["a dog sitting on a bed looking at a pink wall","a brown dog sitting in front of a pink wall","two people are cross country skiing in the snow","a woman is cross country skiing in the snow","a woman is cross country skiing in the snow"]
|
22 |
_CAPTION = json.load(open("caption.json", 'r'))
|
@@ -41,11 +42,14 @@ class ImageSet(datasets.GeneratorBasedBuilder):
|
|
41 |
def _split_generators(self, dl_manager):
|
42 |
images_archive = dl_manager.download(_REPO_URL)
|
43 |
image_iters = dl_manager.iter_archive(images_archive)
|
|
|
|
|
44 |
return [
|
45 |
datasets.SplitGenerator(
|
46 |
name=datasets.Split.TRAIN,
|
47 |
gen_kwargs={
|
48 |
"images": image_iters
|
|
|
49 |
}
|
50 |
),
|
51 |
]
|
|
|
17 |
_LICENSE = ""
|
18 |
|
19 |
_REPO_URL = "https://huggingface.co/datasets/ppp121386/Image-demo/resolve/main/images.tar.gz"
|
20 |
+
_CAPTION_URL = "https://huggingface.co/datasets/ppp121386/Image-demo/resolve/main/caption.json"
|
21 |
|
22 |
# _CAPTION = ["a dog sitting on a bed looking at a pink wall","a brown dog sitting in front of a pink wall","two people are cross country skiing in the snow","a woman is cross country skiing in the snow","a woman is cross country skiing in the snow"]
|
23 |
_CAPTION = json.load(open("caption.json", 'r'))
|
|
|
42 |
def _split_generators(self, dl_manager):
|
43 |
images_archive = dl_manager.download(_REPO_URL)
|
44 |
image_iters = dl_manager.iter_archive(images_archive)
|
45 |
+
caption_archive = dl_manager.download(_CAPTION_URL)
|
46 |
+
# caption_iters = dl_manager.iter_archive(caption_archive)
|
47 |
return [
|
48 |
datasets.SplitGenerator(
|
49 |
name=datasets.Split.TRAIN,
|
50 |
gen_kwargs={
|
51 |
"images": image_iters
|
52 |
+
# "captions":caption_iters
|
53 |
}
|
54 |
),
|
55 |
]
|