mirror of
https://github.com/sml2h3/ocr_api_server.git
synced 2025-05-03 04:20:42 +08:00
修复部分参数校验
This commit is contained in:
parent
901103a7e3
commit
f9e3624eff
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user