Spaces:
Running
Running
Update app.py
Browse files
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 |
-
|
|
|
|
|
|
|
|
|
|
| 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 |
|