Florent Gbelidji commited on
Commit
e07051f
·
verified ·
1 Parent(s): 7abe557

Sync DeepSeek OCR HF job code

Browse files
Files changed (1) hide show
  1. ds_batch_ocr/stages.py +9 -5
ds_batch_ocr/stages.py CHANGED
@@ -247,13 +247,17 @@ def run_stage_extract(settings: ExtractSettings) -> None:
247
  {
248
  "sample_id": str(ctx["sample_id"]),
249
  "dataset_index": int(ctx["dataset_index"]),
250
- "document_path": str(document_path),
251
- "raw_response_path": str(raw_response_path),
252
  "source_image_path": str(source_image_path),
253
- "document_with_boxes_path": str(document_with_boxes_path),
254
  "document_markdown_text": str(markdown),
255
  "extracted_figures": [str(figure.image_path) for figure in figures],
256
- "extracted_figures_metadata": [asdict(figure) for figure in figures],
 
 
 
 
 
 
257
  }
258
  )
259
  extracted_figures_metadata = [asdict(figure) for figure in figures]
@@ -370,7 +374,7 @@ def run_stage_extract(settings: ExtractSettings) -> None:
370
  extract_commit = f"Upload extract stage outputs {__now_iso()}"
371
 
372
 
373
- dataset = load_dataset("json", data_files=document_batch_files)
374
 
375
  token = os.environ.get("HF_TOKEN", None)
376
  dataset.push_to_hub(
 
247
  {
248
  "sample_id": str(ctx["sample_id"]),
249
  "dataset_index": int(ctx["dataset_index"]),
 
 
250
  "source_image_path": str(source_image_path),
251
+ "document_with_boxes_image_path": str(document_with_boxes_path),
252
  "document_markdown_text": str(markdown),
253
  "extracted_figures": [str(figure.image_path) for figure in figures],
254
+ "extracted_figures_metadata": [
255
+ json.dumps(asdict(figure)) for figure in figures
256
+ ],
257
+ "document_markdown_path": str(document_path),
258
+ "document_final_markdown_path": "", # or a real value later
259
+ "document_final_markdown_text": "", # or a real value later
260
+ "raw_response_path": str(raw_response_path),
261
  }
262
  )
263
  extracted_figures_metadata = [asdict(figure) for figure in figures]
 
374
  extract_commit = f"Upload extract stage outputs {__now_iso()}"
375
 
376
 
377
+ dataset = load_dataset("json", data_files=document_batch_files, features=_dataset_features())
378
 
379
  token = os.environ.get("HF_TOKEN", None)
380
  dataset.push_to_hub(