From 41eae738acc55399e403fab4fd5e662521dca031 Mon Sep 17 00:00:00 2001 From: HIllya51 <1871535768@qq.com> Date: Wed, 17 Jan 2024 00:26:22 +0800 Subject: [PATCH] Update local.py --- LunaTranslator/LunaTranslator/ocrengines/local.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/LunaTranslator/LunaTranslator/ocrengines/local.py b/LunaTranslator/LunaTranslator/ocrengines/local.py index d8814f24..1f61806f 100644 --- a/LunaTranslator/LunaTranslator/ocrengines/local.py +++ b/LunaTranslator/LunaTranslator/ocrengines/local.py @@ -35,8 +35,10 @@ class ocrwrapper: self._OcrInit(det,rec,key) def ocr(self,path,name,angle=0): try: - self._OcrDetect(path,name,angle) - return self._OcrGet().decode('utf8') + if (self._OcrDetect(path,name,angle) ): + return self._OcrGet().decode('utf8') + else: + return '' except: return ''