Datasets:
Youssef Benhachem
commited on
Commit
•
3ff5d9c
1
Parent(s):
c45e973
debugging
Browse files
KHATT.py
CHANGED
@@ -96,15 +96,15 @@ class KHATT(datasets.GeneratorBasedBuilder):
|
|
96 |
# image filepath format: <FormNo>_<ParagraphNo>_<LineNo>.TIF
|
97 |
root, _ = os.path.splitext(path)
|
98 |
txt_path = root + ".txt"
|
99 |
-
# txt_path = path[:-4] + ".txt"
|
|
|
100 |
else:
|
101 |
text = ""
|
102 |
|
103 |
elif path.endswith(".txt"):
|
104 |
text = file.read()
|
105 |
|
106 |
-
|
107 |
-
ex = {"image": {"path": path, "bytes": file.read()}, "text": text}
|
108 |
yield idx, ex
|
109 |
idx += 1
|
110 |
"""
|
|
|
96 |
# image filepath format: <FormNo>_<ParagraphNo>_<LineNo>.TIF
|
97 |
root, _ = os.path.splitext(path)
|
98 |
txt_path = root + ".txt"
|
99 |
+
# txt_path = path[:-4] + ".txt"
|
100 |
+
img_file = file
|
101 |
else:
|
102 |
text = ""
|
103 |
|
104 |
elif path.endswith(".txt"):
|
105 |
text = file.read()
|
106 |
|
107 |
+
ex = {"image": {"path": path, "bytes": img_file.read()}, "text": text}
|
|
|
108 |
yield idx, ex
|
109 |
idx += 1
|
110 |
"""
|