Gabriel commited on
Commit
6654e8f
1 Parent(s): 8b8a7c4

Update load_script.py

Browse files
Files changed (1) hide show
  1. 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
- dataset_rows = zip(images, metadata_list)
57
- for img_obj, meta_txt in dataset_rows:
58
- file_path, file_obj = img_obj
59
  yield file_path, {
60
- "image": {"path": file_path, "bytes": file_obj.read()},
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
  }