Download examples/ocr_page.py from docsumo/sumoOCR-tiny: direct link, hf CLI and curl.
- Browser
- Download file 382 Bytes
-
https://huggingface.co/docsumo/sumoOCR-tiny/resolve/main/examples/ocr_page.py
- Command line
-
hf download hf://docsumo/sumoOCR-tiny/examples/ocr_page.py
-
curl -L -o ocr_page.py https://huggingface.co/docsumo/sumoOCR-tiny/resolve/main/examples/ocr_page.py
382 Bytes
| """Read a page and print its lines with confidence and box. python examples/ocr_page.py [image]""" | |
| import os | |
| import sys | |
| from sumoocr import SumoOCR | |
| path = sys.argv[1] if len(sys.argv) > 1 else os.path.join(os.path.dirname(__file__), "invoice.png") | |
| ocr = SumoOCR() | |
| for line in ocr(path): | |
| x0, y0 = line.box[0] | |
| print(f"{line.conf:.2f} ({x0:6.0f}, {y0:6.0f}) {line.text}") | |