Update portugues_ocr_dataset.py
Browse files- portugues_ocr_dataset.py +1 -21
portugues_ocr_dataset.py
CHANGED
@@ -4,7 +4,7 @@ import datasets
|
|
4 |
_CITATION = """\
|
5 |
@misc{portuguesocr2025,
|
6 |
title={Portuguese OCR Dataset},
|
7 |
-
author={
|
8 |
year={2025},
|
9 |
howpublished={\\url{https://huggingface.co/datasets/mazafard/portugues_ocr_dataset}},
|
10 |
}
|
@@ -30,23 +30,3 @@ class PortuguesOcrDataset(datasets.GeneratorBasedBuilder):
|
|
30 |
citation=_CITATION,
|
31 |
)
|
32 |
|
33 |
-
def _split_generators(self, dl_manager):
|
34 |
-
data_path = dl_manager.download_and_extract("https://huggingface.co/datasets/mazafard/portugues_ocr_dataset/resolve/main/dataset.h5")
|
35 |
-
return [
|
36 |
-
datasets.SplitGenerator(
|
37 |
-
name=datasets.Split.TRAIN,
|
38 |
-
gen_kwargs={"file_path": data_path}
|
39 |
-
)
|
40 |
-
]
|
41 |
-
|
42 |
-
def _generate_examples(self, file_path):
|
43 |
-
with h5py.File(file_path, "r") as f:
|
44 |
-
images = f["images"]
|
45 |
-
texts = f["texts"]
|
46 |
-
|
47 |
-
for idx in range(len(texts)):
|
48 |
-
text = texts[idx].decode("utf-8") if isinstance(texts[idx], bytes) else texts[idx]
|
49 |
-
yield idx, {
|
50 |
-
"image": images[idx],
|
51 |
-
"text": text
|
52 |
-
}
|
|
|
4 |
_CITATION = """\
|
5 |
@misc{portuguesocr2025,
|
6 |
title={Portuguese OCR Dataset},
|
7 |
+
author={Mohammadreza Asadollahifard, M.},
|
8 |
year={2025},
|
9 |
howpublished={\\url{https://huggingface.co/datasets/mazafard/portugues_ocr_dataset}},
|
10 |
}
|
|
|
30 |
citation=_CITATION,
|
31 |
)
|
32 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|