File tree Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Original file line number Diff line number Diff line change 16
16
# arguments from the pipeline class, to reduce boilerplate and improve
17
17
# maintainability?
18
18
19
+ import os
19
20
import sys
20
21
import warnings
21
22
@@ -109,6 +110,12 @@ def __init__(
109
110
text_detection_model_name = det_model_name
110
111
text_recognition_model_name = rec_model_name
111
112
else :
113
+ if text_detection_model_dir is not None and text_detection_model_name is None :
114
+ text_detection_model_name = os .path .basename (text_detection_model_dir )
115
+
116
+ if text_recognition_model_dir is not None and text_recognition_model_name is None :
117
+ text_recognition_model_name = os .path .basename (text_recognition_model_dir )
118
+
112
119
if lang is not None or ocr_version is not None :
113
120
warnings .warn (
114
121
"`lang` and `ocr_version` will be ignored when model names or model directories are not `None`." ,
You can’t perform that action at this time.
0 commit comments