Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -100,28 +100,7 @@ def extract_invoice_data(file_data, content_type, json_schema):
|
|
| 100 |
Extracts invoice data from PDFs (text-based) and images using OpenAI's GPT-4o-mini model.
|
| 101 |
Ensures accurate JSON schema binding.
|
| 102 |
"""
|
| 103 |
-
system_prompt = "
|
| 104 |
-
Your task is to extract key fields from an invoice image. Ensure accurate extraction and return the data in JSON format.
|
| 105 |
-
|
| 106 |
-
Extract the following fields:
|
| 107 |
-
1. Line Items: A list containing:
|
| 108 |
-
- Product Code
|
| 109 |
-
- Description
|
| 110 |
-
- Amount (numeric)
|
| 111 |
-
2. Tax Amount (if available)
|
| 112 |
-
3. Vendor GST (if available)
|
| 113 |
-
4. Vendor Name
|
| 114 |
-
5. Invoice Date (format: "DD-MMM-YYYY")
|
| 115 |
-
6. Total Amount (numeric)
|
| 116 |
-
7. Invoice Number (alpha-numeric)
|
| 117 |
-
8. Vendor Address
|
| 118 |
-
9. Invoice Currency
|
| 119 |
-
|
| 120 |
-
Ensure that:
|
| 121 |
-
- All extracted fields match the invoice.
|
| 122 |
-
- If any field is missing, return null instead of hallucinating data.
|
| 123 |
-
- Do not generate synthetic values—only extract real information from the image.
|
| 124 |
-
"""
|
| 125 |
|
| 126 |
base64_images = []
|
| 127 |
base64DataResp = []
|
|
|
|
| 100 |
Extracts invoice data from PDFs (text-based) and images using OpenAI's GPT-4o-mini model.
|
| 101 |
Ensures accurate JSON schema binding.
|
| 102 |
"""
|
| 103 |
+
system_prompt = "You are an expert in invoice data extraction."
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 104 |
|
| 105 |
base64_images = []
|
| 106 |
base64DataResp = []
|