Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -107,22 +107,25 @@ def extract_text_from_unstract(uploaded_file, status_box=None):
|
|
| 107 |
|
| 108 |
def build_prompt(doc_text, checklist):
|
| 109 |
return f"""
|
| 110 |
-
You are a careful, expert document validation agent for mortgage workflows.
|
| 111 |
|
| 112 |
-
|
| 113 |
-
{json.dumps(checklist)}
|
| 114 |
|
| 115 |
-
|
| 116 |
|
| 117 |
-
|
|
|
|
|
|
|
|
|
|
| 118 |
|
| 119 |
-
|
|
|
|
| 120 |
|
| 121 |
-
|
| 122 |
|
| 123 |
Respond with this JSON:
|
| 124 |
{{
|
| 125 |
-
"document_type": "...", //
|
| 126 |
"expiry_date": "...", // ISO format if possible
|
| 127 |
"is_expired": true/false,
|
| 128 |
"looks_genuine": true/false,
|
|
|
|
| 107 |
|
| 108 |
def build_prompt(doc_text, checklist):
|
| 109 |
return f"""
|
| 110 |
+
You are a careful, expert document validation agent for mortgage and finance workflows.
|
| 111 |
|
| 112 |
+
Before you answer, do this: Carefully scan the document for ANY evidence of regional/provincial or country-specific card types (such as "Ontario Health Card", "Medicare Card", "Insurance Card", "SIN", "Driver's License", "Passport", etc.)—be as specific as possible using visible card titles, authority names, or issuer logos.
|
|
|
|
| 113 |
|
| 114 |
+
If you see terms like "Health Card", "Medicare", "Medical Insurance", "OHIP", or any explicit health system/insurance terms, classify it as a health card (e.g. "Ontario Health Card"). Do NOT call it "Identification Card" if a more specific name is visible, even if it is a form of ID.
|
| 115 |
|
| 116 |
+
Checklist for precision:
|
| 117 |
+
- Prefer the **most specific** document type (e.g. "Ontario Health Card" over just "Identification Card" or "Provincial ID").
|
| 118 |
+
- If there is any ambiguity, include relevant keywords from the card (like "Health", "Medicare", "OHIP", "SIN", "Social Insurance", "Driver", etc.) in the output type.
|
| 119 |
+
- If still not sure, show your best guess but include all possible hints from the document text.
|
| 120 |
|
| 121 |
+
Analyze the following extracted document text and this checklist JSON:
|
| 122 |
+
{json.dumps(checklist)}
|
| 123 |
|
| 124 |
+
Follow all prior instructions.
|
| 125 |
|
| 126 |
Respond with this JSON:
|
| 127 |
{{
|
| 128 |
+
"document_type": "...", // e.g. Ontario Health Card, BC Services Card
|
| 129 |
"expiry_date": "...", // ISO format if possible
|
| 130 |
"is_expired": true/false,
|
| 131 |
"looks_genuine": true/false,
|