55import time
66from dataclasses import asdict
77from pathlib import Path
8- from typing import Any , Dict , List , Optional , Sequence , Tuple , Union , get_args
8+ from typing import Any , Dict , List , Optional , Tuple , Union , get_args
99
1010import numpy as np
1111from tqdm import tqdm
@@ -72,6 +72,8 @@ def __call__(
7272 ocr_results : Optional [Tuple [np .ndarray , Tuple [str ], Tuple [float ]]] = None ,
7373 batch_size : int = 1 ,
7474 ) -> RapidTableOutput :
75+ s = time .perf_counter ()
76+
7577 if not isinstance (img_contents , list ):
7678 img_contents = [img_contents ]
7779
@@ -82,11 +84,9 @@ def __call__(
8284 type (img_content ).__name__ if img_content is not None else "None"
8385 )
8486 raise TypeError (
85- f"Type Error: Expected input of type [{ type_names } ], but received ' { img_content } ' of type { actual_type } ."
87+ f"Type Error: Expected input of type [{ type_names } ], but received type { actual_type } ."
8688 )
8789
88- s = time .perf_counter ()
89-
9090 results = RapidTableOutput ()
9191
9292 total_nums = len (img_contents )
@@ -119,7 +119,7 @@ def __call__(
119119 return results
120120
121121 def _load_imgs (
122- self , img_content : Union [Sequence [InputType ], InputType ]
122+ self , img_content : Union [List [InputType ], InputType ]
123123 ) -> List [np .ndarray ]:
124124 img_contents = img_content if isinstance (img_content , list ) else [img_content ]
125125 return [self .load_img (img ) for img in img_contents ]
0 commit comments