mirror of
https://github.com/sml2h3/ocr_api_server.git
synced 2025-05-03 10:32:03 +08:00
修正引用关系
This commit is contained in:
parent
579dbff237
commit
dc22b9e823
@ -2,8 +2,8 @@ import uvicorn
|
|||||||
from fastapi import FastAPI, File, UploadFile, HTTPException, Form
|
from fastapi import FastAPI, File, UploadFile, HTTPException, Form
|
||||||
from typing import Optional, Union
|
from typing import Optional, Union
|
||||||
import base64
|
import base64
|
||||||
from .models import OCRRequest, SlideMatchRequest, DetectionRequest, APIResponse
|
from app.models import OCRRequest, SlideMatchRequest, DetectionRequest, APIResponse
|
||||||
from .services import ocr_service
|
from app.services import ocr_service
|
||||||
|
|
||||||
app = FastAPI()
|
app = FastAPI()
|
||||||
|
|
||||||
@ -38,7 +38,7 @@ async def ocr_endpoint(
|
|||||||
png_fix: bool = Form(False)
|
png_fix: bool = Form(False)
|
||||||
):
|
):
|
||||||
try:
|
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")
|
return APIResponse(code=400, message="Either file or image must be provided")
|
||||||
|
|
||||||
image_bytes = await decode_image(file or image)
|
image_bytes = await decode_image(file or image)
|
||||||
@ -74,7 +74,7 @@ async def detection_endpoint(
|
|||||||
image: Optional[str] = Form(None)
|
image: Optional[str] = Form(None)
|
||||||
):
|
):
|
||||||
try:
|
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")
|
return APIResponse(code=400, message="Either file or image must be provided")
|
||||||
|
|
||||||
image_bytes = await decode_image(file or image)
|
image_bytes = await decode_image(file or image)
|
||||||
|
Loading…
Reference in New Issue
Block a user