Spaces:
Paused
Paused
File size: 794 Bytes
bf03a84 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
from pydantic import BaseModel
from typing import Optional, List, Union, Any
class ImageInput(BaseModel):
image: Optional[str] = None # For base64 string
class OCRRequest(ImageInput):
probability: bool = False
charsets: Optional[str] = None
png_fix: bool = False
class OCRResponse(BaseModel):
result: Union[str, dict]
class SlideMatchRequest(BaseModel):
target: Optional[str] = None # For base64 string
background: Optional[str] = None # For base64 string
simple_target: bool = False
class SlideMatchResponse(BaseModel):
result: List[int]
class DetectionRequest(ImageInput):
pass
class DetectionResponse(BaseModel):
bboxes: List[List[int]]
class APIResponse(BaseModel):
code: int
message: str
data: Optional[Any] = None |