mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-08 12:32:30 +08:00
Fix: judge not empty before delete (#10099)
### What problem does this PR solve? judge not empty before delete session. ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
@ -351,7 +351,8 @@ class TextRecognizer:
|
||||
def close(self):
|
||||
# close session and release manually
|
||||
logging.info('Close TextRecognizer.')
|
||||
del self.predictor
|
||||
if hasattr(self, "predictor"):
|
||||
del self.predictor
|
||||
gc.collect()
|
||||
|
||||
def __call__(self, img_list):
|
||||
@ -490,7 +491,8 @@ class TextDetector:
|
||||
|
||||
def close(self):
|
||||
logging.info("Close TextDetector.")
|
||||
del self.predictor
|
||||
if hasattr(self, "predictor"):
|
||||
del self.predictor
|
||||
gc.collect()
|
||||
|
||||
def __call__(self, img):
|
||||
|
||||
@ -408,7 +408,8 @@ class Recognizer:
|
||||
|
||||
def close(self):
|
||||
logging.info("Close recognizer.")
|
||||
del self.ort_sess
|
||||
if hasattr(self, "ort_sess"):
|
||||
del self.ort_sess
|
||||
gc.collect()
|
||||
|
||||
def __call__(self, image_list, thr=0.7, batch_size=16):
|
||||
|
||||
Reference in New Issue
Block a user