Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -390,7 +390,10 @@ async def process_photo(image_id: str = Form(...), user_id: str = Form(...)):
|
|
| 390 |
return {"error": "An error occurred while processing the image"}
|
| 391 |
|
| 392 |
data = json.loads(dataJson)
|
| 393 |
-
|
|
|
|
|
|
|
|
|
|
| 394 |
logging.info(f"user_data: {user_data}")
|
| 395 |
# Check if 'receipts' key exists and the length
|
| 396 |
found_receipt_no = len(data['receipts']) if 'receipts' in data else 0
|
|
|
|
| 390 |
return {"error": "An error occurred while processing the image"}
|
| 391 |
|
| 392 |
data = json.loads(dataJson)
|
| 393 |
+
if 'receipt' in data and isinstance(data['receipt'], list):
|
| 394 |
+
data['receipt'] = [str(element) for element in data['receipt']]
|
| 395 |
+
if 'busi_cards' in data and isinstance(data['busi_cards'], list):
|
| 396 |
+
data['busi_cards'] = [str(element) for element in data['busi_cards']]
|
| 397 |
logging.info(f"user_data: {user_data}")
|
| 398 |
# Check if 'receipts' key exists and the length
|
| 399 |
found_receipt_no = len(data['receipts']) if 'receipts' in data else 0
|