Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 33bed15

Browse files
committed
update vocr types and added confidence
1 parent b6efb2e commit 33bed15

File tree

1 file changed

+25
-3
lines changed

1 file changed

+25
-3
lines changed

jigsawstack/vision.py

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -152,13 +152,31 @@ class VOCRParams(TypedDict):
152152
page_range: NotRequired[List[int]]
153153

154154

155+
class Word(TypedDict):
156+
text: str
157+
bounds: BoundingBox
158+
confidence: float
159+
160+
161+
class Line(TypedDict):
162+
text: str
163+
bounds: BoundingBox
164+
average_confidence: float
165+
words: List[Word]
166+
167+
168+
class Section(TypedDict):
169+
text: str
170+
lines: List[Line]
171+
172+
155173
class OCRResponse(BaseResponse):
156174
context: str
157175
width: int
158176
height: int
159177
tags: List[str]
160178
has_text: bool
161-
sections: List[object]
179+
sections: List[Section]
162180
total_pages: Optional[int]
163181
page_range: Optional[
164182
List[int]
@@ -215,7 +233,9 @@ def vocr(
215233
return resp
216234

217235
@overload
218-
def object_detection(self, params: ObjectDetectionParams) -> ObjectDetectionResponse: ...
236+
def object_detection(
237+
self, params: ObjectDetectionParams
238+
) -> ObjectDetectionResponse: ...
219239
@overload
220240
def object_detection(
221241
self, blob: bytes, options: ObjectDetectionParams = None
@@ -295,7 +315,9 @@ async def vocr(
295315
return resp
296316

297317
@overload
298-
async def object_detection(self, params: ObjectDetectionParams) -> ObjectDetectionResponse: ...
318+
async def object_detection(
319+
self, params: ObjectDetectionParams
320+
) -> ObjectDetectionResponse: ...
299321
@overload
300322
async def object_detection(
301323
self, blob: bytes, options: ObjectDetectionParams = None

0 commit comments

Comments
 (0)