jamescalam AlhitawiMohammed22 commited on
Commit
93edd1b
1 Parent(s): 180fdae

Function Enhancement (#1)

Browse files

- Function Enhancement (9adbb122ae41f58caccc386cab933e3b724d9626)


Co-authored-by: Alhitawi Mohammed <AlhitawiMohammed22@users.noreply.huggingface.co>

Files changed (1) hide show
  1. image-text-demo.py +3 -4
image-text-demo.py CHANGED
@@ -47,13 +47,12 @@ class ImageSet(datasets.GeneratorBasedBuilder):
47
  ]
48
 
49
  def _generate_examples(self, images):
50
- """This function returns the examples in the raw (text) form."""
51
- idx = 0
52
- for filepath, image in images:
53
  description = filepath.split('/')[-1][:-4]
54
  description = description.replace('_', ' ')
55
  yield idx, {
56
  "image": {"path": filepath, "bytes": image.read()},
57
  "text": description,
58
  }
59
- idx += 1
 
47
  ]
48
 
49
  def _generate_examples(self, images):
50
+ """ This function returns the examples in the raw (text) form."""
51
+
52
+ for idx, (filepath, image) in enumerate(images):
53
  description = filepath.split('/')[-1][:-4]
54
  description = description.replace('_', ' ')
55
  yield idx, {
56
  "image": {"path": filepath, "bytes": image.read()},
57
  "text": description,
58
  }