From dc22b9e823bc15a427790f38cf4b5bee5e3a8427 Mon Sep 17 00:00:00 2001 From: sml2h3 Date: Wed, 13 Nov 2024 10:23:50 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E5=BC=95=E7=94=A8=E5=85=B3?= =?UTF-8?q?=E7=B3=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/main.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/main.py b/app/main.py index 1393dcd..65901cd 100644 --- a/app/main.py +++ b/app/main.py @@ -2,8 +2,8 @@ import uvicorn from fastapi import FastAPI, File, UploadFile, HTTPException, Form from typing import Optional, Union import base64 -from .models import OCRRequest, SlideMatchRequest, DetectionRequest, APIResponse -from .services import ocr_service +from app.models import OCRRequest, SlideMatchRequest, DetectionRequest, APIResponse +from app.services import ocr_service app = FastAPI() @@ -38,7 +38,7 @@ async def ocr_endpoint( png_fix: bool = Form(False) ): try: - if file.size == 0 and image is None: + if file is None and image is None: return APIResponse(code=400, message="Either file or image must be provided") image_bytes = await decode_image(file or image) @@ -74,7 +74,7 @@ async def detection_endpoint( image: Optional[str] = Form(None) ): try: - if file.size == 0 and image is None: + if file is None and image is None: return APIResponse(code=400, message="Either file or image must be provided") image_bytes = await decode_image(file or image)