chandini2595 commited on
Commit
66ff8f7
·
1 Parent(s): 195deb3
Files changed (1) hide show
  1. app.py +11 -4
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
- Return the result as a JSON object with these fields.
 
 
 
 
 
 
 
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}\"\"\"