From 2b25cdd1d48314a529a90fbbd8e65ce3a3a1377c Mon Sep 17 00:00:00 2001 From: Matthew Liu <96169489+TheMattBin@users.noreply.github.com> Date: Sun, 5 May 2024 11:29:31 +0800 Subject: [PATCH] Update ocr.py --- surya/ocr.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/surya/ocr.py b/surya/ocr.py index 123e888d..6ee9b939 100644 --- a/surya/ocr.py +++ b/surya/ocr.py @@ -62,7 +62,7 @@ def run_recognition(images: List[Image.Image], langs: List[List[str]], rec_model def run_ocr(images: List[Image.Image], langs: List[List[str]], det_model, det_processor, rec_model, rec_processor) -> List[OCRResult]: det_predictions = batch_text_detection(images, det_model, det_processor) - if det_model.device == "cuda": + if det_model.device.type == "cuda": torch.cuda.empty_cache() # Empty cache from first model run slice_map = []