Skip to content

Extract values from Google OCR #1

@titipata

Description

@titipata
annotations = api.recognize(image)
plain_text = " ".join([anno.description for anno in annotations])

prompt = f"""You are an expert in analyzing Thai vehicle registration documents. Your task is to extract specific information from the following OCR text of a Thai vehicle registration document. Please identify and extract the following information, providing the values in Thai where applicable. If a piece of information is not found or unclear, respond with "ไม่พบข้อมูล" (Information not found).

OCR Text: {plain_text}

Please extract and provide the following information:

1. วันจดทะเบียน (date_of_registration):
2. เลขทะเบียน (registration_no):
3. จังหวัด (car_province):
4. ประเภท (vehicle_use):
5. รย. (type):
6. ลักษณะ (body_style):
7. ยี่ห้อรถ (manufacturer):
8. แบบ (model):
9. รุ่นปี คศ (year):
10. สี (color):
11. เลขตัวรถ (chassis_number):
12. อยู่ที่ (chassis_location):
13. ยี่ห้อเครื่องยนต์ (engine_manufacturer):
14. เลขเครื่องยนต์ (engine_number):
15. อยู่ที่ (engine_location):
16. เชื้อเพลิง (fuel_type):
17. เลขถังแก๊ส (fuel_tank_number):
18. จำนวน (cylinders):
19. ซีซี (cubic_capacity):
20. แรงม้า (horse_power):
21. จำนวนเพลาและล้อ (axles_wheels_no):
22. น้ำหนักรถ (unladen_weight):
23. น้ำหนักบรรทุก/น้ำหนักเพลา (load_capacity):
24. น้ำหนักรวม (gross_weight):
25. ที่นั่ง (seats):

Please provide the extracted information in a structured JSON format. Listing each item in a given English key with its corresponding value."""

parsed_output = get_model_response(prompt) # prompt with LLama3.1
print(parsed_output)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions