@@ -529,31 +529,30 @@ def __init__(self, model_dir=None):
529
529
"rag/res/deepdoc" )
530
530
531
531
# Append muti-gpus task to the list
532
- if PARALLEL_DEVICES is not None and PARALLEL_DEVICES > 0 :
532
+ if PARALLEL_DEVICES > 0 :
533
533
self .text_detector = []
534
534
self .text_recognizer = []
535
535
for device_id in range (PARALLEL_DEVICES ):
536
536
self .text_detector .append (TextDetector (model_dir , device_id ))
537
537
self .text_recognizer .append (TextRecognizer (model_dir , device_id ))
538
538
else :
539
- self .text_detector = [TextDetector (model_dir , 0 )]
540
- self .text_recognizer = [TextRecognizer (model_dir , 0 )]
539
+ self .text_detector = [TextDetector (model_dir )]
540
+ self .text_recognizer = [TextRecognizer (model_dir )]
541
541
542
542
except Exception :
543
543
model_dir = snapshot_download (repo_id = "InfiniFlow/deepdoc" ,
544
544
local_dir = os .path .join (get_project_base_directory (), "rag/res/deepdoc" ),
545
545
local_dir_use_symlinks = False )
546
546
547
- if PARALLEL_DEVICES is not None :
548
- assert PARALLEL_DEVICES > 0 , "Number of devices must be >= 1"
547
+ if PARALLEL_DEVICES > 0 :
549
548
self .text_detector = []
550
549
self .text_recognizer = []
551
550
for device_id in range (PARALLEL_DEVICES ):
552
551
self .text_detector .append (TextDetector (model_dir , device_id ))
553
552
self .text_recognizer .append (TextRecognizer (model_dir , device_id ))
554
553
else :
555
- self .text_detector = [TextDetector (model_dir , 0 )]
556
- self .text_recognizer = [TextRecognizer (model_dir , 0 )]
554
+ self .text_detector = [TextDetector (model_dir )]
555
+ self .text_recognizer = [TextRecognizer (model_dir )]
557
556
558
557
self .drop_score = 0.5
559
558
self .crop_image_res_index = 0
0 commit comments