第一次提交
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
"""OCR 引擎抽象接口。"""
|
||||
from dataclasses import dataclass
|
||||
from typing import Protocol
|
||||
|
||||
|
||||
@dataclass
|
||||
class OcrResult:
|
||||
markdown: str
|
||||
confidence: float # 0-1,未知时给 1.0
|
||||
engine: str # "pix2text" / "vlm"
|
||||
|
||||
|
||||
class OcrEngine(Protocol):
|
||||
async def recognize(self, image_bytes: bytes, mime: str) -> OcrResult: ...
|
||||
Reference in New Issue
Block a user