This commit is contained in:
dingfeng.wong
2025-07-22 01:30:30 +08:00
parent 27b391d7fe
commit a3779aa3f9
+2 -2
View File
@@ -56,8 +56,8 @@ def perform_ocr(image_path: str, lang: str = 'eng') -> str:
Extracted text from the image
"""
try:
# Load the OCR model with reliable architecture
model = ocr_predictor(det_arch='db_resnet50', reco_arch='crnn_vgg16_bn', pretrained=True)
# Load the OCR model with state-of-the-art PARSeq recognition
model = ocr_predictor(det_arch='db_resnet50', reco_arch='parseq', pretrained=True)
# Load the document from the image file
doc = DocumentFile.from_images(image_path)