From fd8318b559f6576fdd573d32ee31b25ad7d49a0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=85=B0=E6=B6=9B?= <550947002@qq.com> Date: Wed, 14 Aug 2024 12:02:18 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8Dfile=E4=B8=BA=E7=A9=BA?= =?UTF-8?q?=E6=98=AF=E6=8A=A5=E9=94=99=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/main.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/main.py b/app/main.py index 532a4bc..9053fa6 100644 --- a/app/main.py +++ b/app/main.py @@ -38,7 +38,7 @@ async def ocr_endpoint( png_fix: bool = Form(False) ): try: - if file.size == 0 and image is None: + if file and file.file._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 and file.file._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)