Update app.py
Browse files
app.py
CHANGED
@@ -83,7 +83,8 @@ def convert_dicts_to_list(dicts: List[Dict], add_link: bool = False,
|
|
83 |
timestamp = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
|
84 |
|
85 |
for dict_item in dicts:
|
86 |
-
row = list(dict_item.values())
|
|
|
87 |
|
88 |
# Always add timestamp to the first index
|
89 |
row.insert(0, timestamp)
|
@@ -390,12 +391,6 @@ 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 |
-
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"data: {data}")
|
398 |
-
logging.info(f"user_data: {user_data}")
|
399 |
# Check if 'receipts' key exists and the length
|
400 |
found_receipt_no = len(data['receipts']) if 'receipts' in data else 0
|
401 |
found_business_cards_no = len(data['busi_cards']) if 'busi_cards' in data else 0
|
|
|
83 |
timestamp = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
|
84 |
|
85 |
for dict_item in dicts:
|
86 |
+
# row = list(dict_item.values())
|
87 |
+
row = [str(value) for value in dict_item.values()]
|
88 |
|
89 |
# Always add timestamp to the first index
|
90 |
row.insert(0, timestamp)
|
|
|
391 |
return {"error": "An error occurred while processing the image"}
|
392 |
|
393 |
data = json.loads(dataJson)
|
|
|
|
|
|
|
|
|
|
|
|
|
394 |
# Check if 'receipts' key exists and the length
|
395 |
found_receipt_no = len(data['receipts']) if 'receipts' in data else 0
|
396 |
found_business_cards_no = len(data['busi_cards']) if 'busi_cards' in data else 0
|