Spaces:
Sleeping
Sleeping
Commit
·
66ff8f7
1
Parent(s):
195deb3
added
Browse files
app.py
CHANGED
@@ -97,14 +97,21 @@ def extract_products(text):
|
|
97 |
|
98 |
def extract_with_perplexity_llm(ocr_text):
|
99 |
prompt = f"""
|
100 |
-
Extract the following fields from this receipt text:
|
101 |
- name (customer name)
|
|
|
|
|
102 |
- date
|
103 |
-
- products (list of {{name, price}})
|
104 |
-
- amount_paid (total)
|
105 |
- receipt_no
|
106 |
|
107 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
108 |
|
109 |
Text:
|
110 |
\"\"\"{ocr_text}\"\"\"
|
|
|
97 |
|
98 |
def extract_with_perplexity_llm(ocr_text):
|
99 |
prompt = f"""
|
100 |
+
Extract the following fields from this receipt text and return them as a single flat JSON object:
|
101 |
- name (customer name)
|
102 |
+
- product (main product name)
|
103 |
+
- price (main product price)
|
104 |
- date
|
|
|
|
|
105 |
- receipt_no
|
106 |
|
107 |
+
Example output:
|
108 |
+
{{
|
109 |
+
"name": "ABS",
|
110 |
+
"product": "airpods",
|
111 |
+
"price": "579.18",
|
112 |
+
"date": "12/13/2024",
|
113 |
+
"receipt_no": "042085"
|
114 |
+
}}
|
115 |
|
116 |
Text:
|
117 |
\"\"\"{ocr_text}\"\"\"
|