Skip to content

Instantly share code, notes, and snippets.

@ClimenteA
Created December 15, 2025 09:13
Show Gist options
  • Select an option

  • Save ClimenteA/e70757d370fbb94631e4e292cdbad806 to your computer and use it in GitHub Desktop.

Select an option

Save ClimenteA/e70757d370fbb94631e4e292cdbad806 to your computer and use it in GitHub Desktop.
Extract text from image using Python PaddleOCR
# 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