Datasets:
Update load_script.py
Browse files- load_script.py +4 -5
load_script.py
CHANGED
@@ -52,11 +52,10 @@ class ExampleImages(datasets.GeneratorBasedBuilder):
|
|
52 |
def _generate_examples(self, images, metadata_path):
|
53 |
"""Generate images and text."""
|
54 |
with open(metadata_path, encoding="utf-8") as f:
|
55 |
-
metadata_list = f.read().split("\n")
|
56 |
-
|
57 |
-
|
58 |
-
file_path, file_obj = img_obj
|
59 |
yield file_path, {
|
60 |
-
"image": {"path":
|
61 |
"text": meta_txt,
|
62 |
}
|
|
|
52 |
def _generate_examples(self, images, metadata_path):
|
53 |
"""Generate images and text."""
|
54 |
with open(metadata_path, encoding="utf-8") as f:
|
55 |
+
metadata_list = f.read().split("\n")
|
56 |
+
for img_obj, meta_txt in zip(images, metadata_list):
|
57 |
+
filepath, image = img_obj
|
|
|
58 |
yield file_path, {
|
59 |
+
"image": {"path": filepath, "bytes": image.read()},
|
60 |
"text": meta_txt,
|
61 |
}
|