File size: 531 Bytes
ea74d74
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
from paddleocr import PaddleOCR
import cv2

ocr_model = PaddleOCR(use_angle_cls=True, lang='en')

def process_image(image_path):
    result = ocr_model.ocr(image_path, cls=True)
    extracted_data = []
    for line in result[0]:
        text = line[1][0]
        # Simple parser, in real case you’ll parse with regex or templates
        extracted_data.append({
            "Product Name": text,
            "Model": "",
            "HP": "",
            "Stage": "",
            "Price": ""
        })
    return extracted_data