Florent Gbelidji commited on
Sync DeepSeek OCR HF job code
Browse files- ds_batch_ocr/stages.py +9 -9
ds_batch_ocr/stages.py
CHANGED
|
@@ -299,15 +299,15 @@ def run_stage_extract(settings: ExtractSettings) -> None:
|
|
| 299 |
#build document metadata
|
| 300 |
batch_document_dicts.append(
|
| 301 |
{
|
| 302 |
-
"sample_id": ctx["sample_id"],
|
| 303 |
-
"dataset_index": ctx["dataset_index"],
|
| 304 |
-
"document_path": document_path,
|
| 305 |
-
"raw_response_path": raw_response_path,
|
| 306 |
-
"source_image_path": ctx["sample_dir"] / "source.png",
|
| 307 |
-
"document_with_boxes_path": ctx["sample_dir"] / "document_with_boxes.png",
|
| 308 |
-
"document_markdown_text": markdown,
|
| 309 |
-
"extracted_figures": [figure.image_path for figure in figures],
|
| 310 |
-
"extracted_figures_metadata": [asdict(figure) for figure in figures],
|
| 311 |
}
|
| 312 |
)
|
| 313 |
|
|
|
|
| 299 |
#build document metadata
|
| 300 |
batch_document_dicts.append(
|
| 301 |
{
|
| 302 |
+
"sample_id": str(ctx["sample_id"]),
|
| 303 |
+
"dataset_index": int(ctx["dataset_index"]),
|
| 304 |
+
"document_path": str(document_path),
|
| 305 |
+
"raw_response_path": str(raw_response_path),
|
| 306 |
+
"source_image_path": str(ctx["sample_dir"] / "source.png"),
|
| 307 |
+
"document_with_boxes_path": str(ctx["sample_dir"] / "document_with_boxes.png"),
|
| 308 |
+
"document_markdown_text": str(markdown),
|
| 309 |
+
"extracted_figures": [str(figure.image_path) for figure in figures],
|
| 310 |
+
"extracted_figures_metadata": [json.dumps(asdict(figure)) for figure in figures],
|
| 311 |
}
|
| 312 |
)
|
| 313 |
|