shubhjo commited on
Commit
dcb88eb
·
verified ·
1 Parent(s): dc02b9e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -3
app.py CHANGED
@@ -91,10 +91,14 @@ async def process_with_gemini(filename: str, raw_text: str):
91
 
92
  try:
93
  prompt = f"""
94
- You are an intelligent invoice data extractor. Given raw text from an invoice in any language, extract key business fields in the specified JSON format. Handle synonyms (e.g., 'total' = 'net', 'tax' = 'GST'/'TDS'). The 'Products' field is dynamic and may contain multiple items, each with 'qty', 'description', 'unit_price', and 'amount'. If a field is missing, include it with an empty string ("") or appropriate default (e.g., 0 for numbers).
 
 
 
 
 
95
 
96
- Raw text:
97
- {raw_text}
98
 
99
  Output JSON:
100
  {{
@@ -113,6 +117,7 @@ async def process_with_gemini(filename: str, raw_text: str):
113
  "invoice date": "",
114
  "invoice number": "",
115
  "shipping address": "",
 
116
  "total": ""
117
  }}
118
  """
 
91
 
92
  try:
93
  prompt = f"""
94
+ You are an intelligent invoice data extractor.
95
+ Given raw text from an invoice in any language,
96
+ extract key business fields in the specified JSON format.
97
+ Handle synonyms (e.g., 'total' = 'net', 'tax' = 'GST'/'TDS'/'VAT'). Extract currency from symbol or acronym as well.
98
+ The 'Products' field is dynamic and may contain multiple items, each with 'qty', 'description', 'unit_price', and 'amount'.
99
+ If a field is missing, include it with an empty string ("") or appropriate default (e.g., 0 for numbers).
100
 
101
+
 
102
 
103
  Output JSON:
104
  {{
 
117
  "invoice date": "",
118
  "invoice number": "",
119
  "shipping address": "",
120
+ "currency": "",
121
  "total": ""
122
  }}
123
  """