"""Read a whole page/screenshot: RapidOCR's detector + this recogniser. pip install rapidocr_onnxruntime==1.4.4 opencv-python-headless huggingface_hub python rapidocr_page.py screenshot.png """ import sys from huggingface_hub import hf_hub_download from rapidocr_onnxruntime import RapidOCR REPO = "ScienceSoft/scnsoft-ocr-rec-multilingual" def main() -> None: engine = RapidOCR( rec_model_path=hf_hub_download(REPO, "rec-multi.onnx"), rec_keys_path=hf_hub_download(REPO, "dict-multi.txt"), ) result, _ = engine(sys.argv[1]) for _box, text, score in result or []: print(f"{float(score):.2f} {text}") if __name__ == "__main__": main()