@@ -60,10 +60,10 @@ def run_recognition(images: List[Image.Image], langs: List[List[str] | None], re
60
60
return predictions_by_image
61
61
62
62
63
- def run_ocr (images : List [Image .Image ], langs : List [List [str ] | None ], det_model , det_processor , rec_model , rec_processor , batch_size = None , highres_images : List [Image .Image ] | None = None ) -> List [OCRResult ]:
63
+ def run_ocr (images : List [Image .Image ], langs : List [List [str ] | None ], det_model , det_processor , rec_model , rec_processor , detection_batch_size = None , recognition_batch_size = None , highres_images : List [Image .Image ] | None = None ) -> List [OCRResult ]:
64
64
images = convert_if_not_rgb (images )
65
65
highres_images = convert_if_not_rgb (highres_images ) if highres_images is not None else [None ] * len (images )
66
- det_predictions = batch_text_detection (images , det_model , det_processor )
66
+ det_predictions = batch_text_detection (images , det_model , det_processor , batch_size = detection_batch_size )
67
67
68
68
all_slices = []
69
69
slice_map = []
@@ -82,7 +82,7 @@ def run_ocr(images: List[Image.Image], langs: List[List[str] | None], det_model,
82
82
all_langs .extend ([lang ] * len (slices ))
83
83
all_slices .extend (slices )
84
84
85
- rec_predictions , confidence_scores = batch_recognition (all_slices , all_langs , rec_model , rec_processor , batch_size = batch_size )
85
+ rec_predictions , confidence_scores = batch_recognition (all_slices , all_langs , rec_model , rec_processor , batch_size = recognition_batch_size )
86
86
87
87
predictions_by_image = []
88
88
slice_start = 0
0 commit comments