Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -95,7 +95,6 @@ async def record_failure(s3_original_url, failed_task, sheetID):
|
|
| 95 |
|
| 96 |
# post the processed image to google apps script
|
| 97 |
async def post_to_google_apps_script(appsScriptsURL, body, s3_orginal_url):
|
| 98 |
-
logging.info(body)
|
| 99 |
async with httpx.AsyncClient(follow_redirects=True, timeout=timeout) as client:
|
| 100 |
response = await client.post(appsScriptsURL, json=body)
|
| 101 |
if response.status_code != 200:
|
|
@@ -165,11 +164,11 @@ async def background_worker(sheeturl, image_contents, filename, content_type, ap
|
|
| 165 |
if countedDoc['num_receipts'] > 0:
|
| 166 |
total_uploaded = user_data.get('receipts_uploaded', 0)
|
| 167 |
current_upload = 'receipts_uploaded'
|
| 168 |
-
|
| 169 |
elif countedDoc['num_business_cards'] > 0:
|
| 170 |
total_uploaded = user_data.get('business_cards_uploaded', 0)
|
| 171 |
current_upload = 'business_cards_uploaded'
|
| 172 |
-
|
| 173 |
|
| 174 |
return {"message": "Image processing completed."}
|
| 175 |
|
|
@@ -294,7 +293,6 @@ async def mobile_process_receipts(background_tasks: BackgroundTasks, sheeturl: s
|
|
| 294 |
"mode": "alert-user",
|
| 295 |
"mimeType": image.content_type,
|
| 296 |
}
|
| 297 |
-
logging.info(body)
|
| 298 |
async with httpx.AsyncClient(follow_redirects=True, timeout=timeout) as client:
|
| 299 |
response = await client.post(appsScriptsURL, json=body)
|
| 300 |
if response.status_code != 200:
|
|
|
|
| 95 |
|
| 96 |
# post the processed image to google apps script
|
| 97 |
async def post_to_google_apps_script(appsScriptsURL, body, s3_orginal_url):
|
|
|
|
| 98 |
async with httpx.AsyncClient(follow_redirects=True, timeout=timeout) as client:
|
| 99 |
response = await client.post(appsScriptsURL, json=body)
|
| 100 |
if response.status_code != 200:
|
|
|
|
| 164 |
if countedDoc['num_receipts'] > 0:
|
| 165 |
total_uploaded = user_data.get('receipts_uploaded', 0)
|
| 166 |
current_upload = 'receipts_uploaded'
|
| 167 |
+
user_doc.update({current_upload: user_data[current_upload] + countedDoc['num_receipts']})
|
| 168 |
elif countedDoc['num_business_cards'] > 0:
|
| 169 |
total_uploaded = user_data.get('business_cards_uploaded', 0)
|
| 170 |
current_upload = 'business_cards_uploaded'
|
| 171 |
+
user_doc.update({current_upload: user_data[current_upload] + countedDoc['num_business_cards']})
|
| 172 |
|
| 173 |
return {"message": "Image processing completed."}
|
| 174 |
|
|
|
|
| 293 |
"mode": "alert-user",
|
| 294 |
"mimeType": image.content_type,
|
| 295 |
}
|
|
|
|
| 296 |
async with httpx.AsyncClient(follow_redirects=True, timeout=timeout) as client:
|
| 297 |
response = await client.post(appsScriptsURL, json=body)
|
| 298 |
if response.status_code != 200:
|