feat: OCR v2 batch + RIIN waybill + 双系统 label-ocr flow(hourly)
This commit is contained in:
@@ -25,6 +25,16 @@ class OcrClient:
|
||||
resp.raise_for_status()
|
||||
return OcrResult.model_validate(resp.json())
|
||||
|
||||
def recognize_batch(self, urls: list[dict[str, str]], country: str = "US") -> list[OcrResult]:
|
||||
"""v2 批量识别:urls=[{"url":"...", "filename":"orderNo"}], 最多 200 项/批。
|
||||
|
||||
返回 OcrResult 列表,file 字段 = filename(用于回匹配 orderNo)。
|
||||
"""
|
||||
resp = self._http.post("/api/v2/batch", json={"urls": urls, "country": country}, timeout=300.0)
|
||||
resp.raise_for_status()
|
||||
data = resp.json()
|
||||
return [OcrResult.model_validate(r) for r in data.get("results", [])]
|
||||
|
||||
def health(self) -> bool:
|
||||
"""健康检查。"""
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user