Raghu commited on
Commit
76eed09
·
1 Parent(s): eb79113

Fix quoting syntax in field extraction block

Browse files
Files changed (1) hide show
  1. app.py +9 -6
app.py CHANGED
@@ -746,12 +746,15 @@ def process_receipt(image):
746
  fields = receipt_ocr.postprocess_receipt(ocr_results)
747
 
748
  fields_html = "<div style='padding: 16px; background: #f8f9fa; border-radius: 12px;'><h4>Extracted Fields</h4>"
749
- for name, value in [('Vendor', fields.get('vendor')), ('Date', fields.get('date')),
750
- ('Total', f\"${fields.get('total')}\" if fields.get('total') else None),
751
- ('Time', fields.get('time'))]:
752
- display = value or '<span style=\"color: #adb5bd;\">Not found</span>'
753
- fields_html += f\"<div style='padding: 8px; background: white; border-radius: 6px; margin: 4px 0;'><b>{name}:</b> {display}</div>\"
754
- fields_html += \"</div>\"
 
 
 
755
  results['fields'] = fields
756
  except Exception as e:
757
  fields_html = f\"<div style='color: red;'>Extraction error: {e}</div>\"
 
746
  fields = receipt_ocr.postprocess_receipt(ocr_results)
747
 
748
  fields_html = "<div style='padding: 16px; background: #f8f9fa; border-radius: 12px;'><h4>Extracted Fields</h4>"
749
+ for name, value in [
750
+ ('Vendor', fields.get('vendor')),
751
+ ('Date', fields.get('date')),
752
+ ('Total', f"${fields.get('total')}" if fields.get('total') else None),
753
+ ('Time', fields.get('time')),
754
+ ]:
755
+ display = value or '<span style="color: #adb5bd;">Not found</span>'
756
+ fields_html += f"<div style='padding: 8px; background: white; border-radius: 6px; margin: 4px 0;'><b>{name}:</b> {display}</div>"
757
+ fields_html += "</div>"
758
  results['fields'] = fields
759
  except Exception as e:
760
  fields_html = f\"<div style='color: red;'>Extraction error: {e}</div>\"