Update NCTCRCHE100K.py
Browse files- NCTCRCHE100K.py +3 -1
NCTCRCHE100K.py
CHANGED
@@ -61,8 +61,10 @@ class NCTCRCHE100K(datasets.GeneratorBasedBuilder):
|
|
61 |
idx = 0
|
62 |
for filepath, image in images:
|
63 |
# extract text from each item
|
|
|
|
|
64 |
yield idx, {
|
65 |
"image": {"path": filepath, "bytes": image.read()},
|
66 |
-
"text": filepath
|
67 |
}
|
68 |
idx += 1
|
|
|
61 |
idx = 0
|
62 |
for filepath, image in images:
|
63 |
# extract text from each item
|
64 |
+
start_index = filepath.find('/') + 1
|
65 |
+
end_index = filepath.find('-', start_index)
|
66 |
yield idx, {
|
67 |
"image": {"path": filepath, "bytes": image.read()},
|
68 |
+
"text": filepath[start_index: end_index]
|
69 |
}
|
70 |
idx += 1
|