MCPcopy Create free account
hub / github.com/Topdu/OpenOCR / save_to_json

Method save_to_json

openocr.py:266–275  ·  view source on GitHub ↗

Save doc task results to JSON (only for doc task). Supports both single result dict and list of results (from PDF).

(self, result, output_path: str)

Source from the content-addressed store, hash-verified

264
265 # Additional methods for doc task
266 def save_to_json(self, result, output_path: str):
267 """Save doc task results to JSON (only for doc task).
268 Supports both single result dict and list of results (from PDF)."""
269 if self.task != 'doc':
270 raise RuntimeError("save_to_json is only available for 'doc' task")
271 if isinstance(result, list):
272 for page_result in result:
273 self.model.save_to_json(page_result, output_path)
274 else:
275 return self.model.save_to_json(result, output_path)
276
277 def save_to_markdown(self, result, output_path: str):
278 """Save doc task results to Markdown (only for doc task).

Callers 3

mainFunction · 0.95
test_python_apiMethod · 0.95
process_imageFunction · 0.45

Calls

no outgoing calls

Tested by 1

test_python_apiMethod · 0.76