Created
December 15, 2025 09:13
-
-
Save ClimenteA/e70757d370fbb94631e4e292cdbad806 to your computer and use it in GitHub Desktop.
Extract text from image using Python PaddleOCR
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # uv add paddlepaddle paddleocr | |
| from paddleocr import PaddleOCR | |
| def extract_text_from_image(image_path: str): | |
| ocr = PaddleOCR( | |
| lang="ro", | |
| device="cpu", | |
| use_angle_cls=False, | |
| ) | |
| result = ocr.predict(image_path) | |
| all_text = [] | |
| for res in result: | |
| texts = res["rec_texts"] | |
| all_text.extend(texts) | |
| return "\n".join(all_text) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment