From f9e3624eff1ed7c2a94811f3d95fe1846aec5b8e Mon Sep 17 00:00:00 2001 From: sml2h3 Date: Tue, 30 Jul 2024 15:52:29 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=83=A8=E5=88=86=E5=8F=82?= =?UTF-8?q?=E6=95=B0=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/main.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/main.py b/app/main.py index 7b4aece..532a4bc 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 is None and image is None: + if file.size == 0 and image is None: return APIResponse(code=400, message="Either file or image must be provided") image_bytes = await decode_image(file or image) @@ -57,7 +57,7 @@ async def slide_match_endpoint( simple_target: bool = Form(False) ): try: - if (target_file is None and target is None) or (background_file is None and background is None): + if (background is None and target is None) or (background_file.size == 0 and target_file.size == 0): return APIResponse(code=400, message="Both target and background must be provided") target_bytes = await decode_image(target_file or target) @@ -74,7 +74,7 @@ async def detection_endpoint( image: Optional[str] = Form(None) ): try: - if file is None and image is None: + if file.size == 0 and image is None: return APIResponse(code=400, message="Either file or image must be provided") image_bytes = await decode_image(file or image)