kamalgodar
commited on
Commit
•
02b3901
1
Parent(s):
67c0935
Update donut-test.py
Browse files- donut-test.py +1 -10
donut-test.py
CHANGED
@@ -46,20 +46,11 @@ class DonutTest(datasets.GeneratorBasedBuilder):
|
|
46 |
|
47 |
def _generate_examples(self, images):
|
48 |
idx = 0
|
49 |
-
image_dir = self.config.data_dir / 'images'
|
50 |
-
os.makedirs(image_dir, exist_ok=True)
|
51 |
|
52 |
for filepath, image in images:
|
53 |
-
image_filename = f'data{idx}.jpg'
|
54 |
-
image_path = image_dir / image_filename
|
55 |
-
|
56 |
-
with open(image_path, 'wb') as f:
|
57 |
-
f.write(image.read())
|
58 |
-
|
59 |
yield idx, {
|
60 |
-
"image": str(image_path),
|
61 |
"json": description[idx],
|
|
|
62 |
}
|
63 |
-
|
64 |
idx += 1
|
65 |
|
|
|
46 |
|
47 |
def _generate_examples(self, images):
|
48 |
idx = 0
|
|
|
|
|
49 |
|
50 |
for filepath, image in images:
|
|
|
|
|
|
|
|
|
|
|
|
|
51 |
yield idx, {
|
|
|
52 |
"json": description[idx],
|
53 |
+
"image": {"path": filepath, "bytes": image.read()},
|
54 |
}
|
|
|
55 |
idx += 1
|
56 |
|