From 4cfa60d5dacf4afb4ea01a80f70da014ba28cf08 Mon Sep 17 00:00:00 2001 From: Odunayo Ogundepo Date: Thu, 25 Dec 2025 19:56:41 +0000 Subject: [PATCH] Update README.md --- README.md | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/README.md b/README.md index f8eba2a..a77e1ed 100644 --- a/README.md +++ b/README.md @@ -202,3 +202,29 @@ def run_inference(model, processor, messages, max_new_tokens=128, device="cuda") ) return outputs[0] ``` + +### End-to-End Example + +```python +model = load_model("taresco/KarantaOCR") +processor = load_processor("taresco/KarantaOCR") + +prompt = """Below is the image of one page of a PDF document. +Just return the plain text representation of this document as if you were reading it naturally. +Turn equations into a LaTeX representation, and tables into markdown format. Remove the headers and footers, but keep references and footnotes. +Read any natural handwriting. +This is likely one page out of several in the document, so be sure to preserve any sentences that come from the previous page, or continue onto the next page, exactly as they are. +If there is no text at all that you think you should read, you can output null. +if the document contains diacritics, please include them in the output. +Do not hallucinate. +""" + +messages = build_message( + image_url="example.pdf", + system_prompt=prompt, + page=0 +) + +output_text = run_inference(model, processor, messages) +print(output_text) +```