RFTSystems commited on
Commit
8291385
·
verified ·
1 Parent(s): b6e17ab

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -1
app.py CHANGED
@@ -932,11 +932,15 @@ def verify_receipt(uploaded_file):
932
  return "❌ Upload a receipt JSON first.", pd.DataFrame([])
933
 
934
  try:
935
- content = uploaded_file.read()
 
 
 
936
  receipt = json.loads(content.decode("utf-8"))
937
  except Exception as e:
938
  return f"❌ Could not read JSON: {e}", pd.DataFrame([])
939
 
 
940
  checks: List[Dict[str, str]] = []
941
  ok = True
942
 
 
932
  return "❌ Upload a receipt JSON first.", pd.DataFrame([])
933
 
934
  try:
935
+ # Gradio on HF often passes a NamedString / filepath
936
+ path = str(uploaded_file)
937
+ with open(path, "rb") as f:
938
+ content = f.read()
939
  receipt = json.loads(content.decode("utf-8"))
940
  except Exception as e:
941
  return f"❌ Could not read JSON: {e}", pd.DataFrame([])
942
 
943
+
944
  checks: List[Dict[str, str]] = []
945
  ok = True
946