Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -184,7 +184,7 @@ async def background_worker(sheeturl, image_contents, filename, content_type, ap
|
|
| 184 |
|
| 185 |
# receive a sheetID and an image as multipart form data
|
| 186 |
@app.post('/mobile-process-receipts')
|
| 187 |
-
async def mobile_process_receipts(background_tasks: BackgroundTasks, sheeturl: str = Form(...),
|
| 188 |
image_contents = await image.read()
|
| 189 |
uuid = str(uuid4())
|
| 190 |
timestamp = str(datetime.now().strftime("%Y-%m-%d %H:%M:%S"))
|
|
@@ -341,22 +341,22 @@ async def cutting_image(masked_image, image_contents, cut_images, s3_orginal_url
|
|
| 341 |
cut_images.append(base64_str)
|
| 342 |
|
| 343 |
|
| 344 |
-
@app.post('/test')
|
| 345 |
-
async def mobile_process_receipts(background_tasks: BackgroundTasks, sheeturl: str = Form(...), user_ref: str = Form(...), image: UploadFile = File(...)):
|
| 346 |
-
|
| 347 |
-
|
| 348 |
-
|
| 349 |
-
|
| 350 |
-
|
| 351 |
-
|
| 352 |
-
|
| 353 |
-
|
| 354 |
-
|
| 355 |
-
|
| 356 |
-
|
| 357 |
-
|
| 358 |
-
|
| 359 |
-
|
| 360 |
-
|
| 361 |
-
|
| 362 |
-
|
|
|
|
| 184 |
|
| 185 |
# receive a sheetID and an image as multipart form data
|
| 186 |
@app.post('/mobile-process-receipts')
|
| 187 |
+
async def mobile_process_receipts(background_tasks: BackgroundTasks, sheeturl: str = Form(...), user_ref: str = Form(...), image: UploadFile = File(...)):
|
| 188 |
image_contents = await image.read()
|
| 189 |
uuid = str(uuid4())
|
| 190 |
timestamp = str(datetime.now().strftime("%Y-%m-%d %H:%M:%S"))
|
|
|
|
| 341 |
cut_images.append(base64_str)
|
| 342 |
|
| 343 |
|
| 344 |
+
# @app.post('/test')
|
| 345 |
+
# async def mobile_process_receipts(background_tasks: BackgroundTasks, sheeturl: str = Form(...), user_ref: str = Form(...), image: UploadFile = File(...)):
|
| 346 |
+
# image_contents = await image.read()
|
| 347 |
+
# uuid = str(uuid4())
|
| 348 |
+
# timestamp = str(datetime.now().strftime("%Y-%m-%d-%H-%M-%S"))
|
| 349 |
+
# message = "영수기가 데이터 분석 중입니다. 잠시만 기다려주세요."
|
| 350 |
+
# data = [timestamp, uuid, message]
|
| 351 |
+
# body = {
|
| 352 |
+
# "sheetID": sheeturl.split('/')[-2],
|
| 353 |
+
# "data": data,
|
| 354 |
+
# "mode": "alert-user"
|
| 355 |
+
# }
|
| 356 |
+
# async with httpx.AsyncClient(follow_redirects=True) as client:
|
| 357 |
+
# response = await client.post(appsScriptsURL, json=body)
|
| 358 |
+
# if response.status_code != 200:
|
| 359 |
+
# logging.error(f"Unexpected response from Google Apps Script API: {response.status_code} - {response.text}")
|
| 360 |
+
# raise HTTPException(status_code=500, detail="Error from external API.")
|
| 361 |
+
# background_tasks.add_task(background_worker, sheeturl, image_contents, image.filename, image.content_type, appsScriptsURL)
|
| 362 |
+
# return {"message": "Image processing completed."}
|