mirror of
https://github.com/HIllya51/LunaTranslator.git
synced 2025-01-01 10:04:12 +08:00
reinit
This commit is contained in:
parent
3763cb9aa4
commit
bea704ca6c
@ -94,13 +94,21 @@ class baseocr(commonbase):
|
|||||||
|
|
||||||
########################################################
|
########################################################
|
||||||
def level2init(self):
|
def level2init(self):
|
||||||
|
self.needinit = True
|
||||||
try:
|
try:
|
||||||
self.initocr()
|
self.initocr()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
raise e
|
raise e
|
||||||
|
self.needinit = False
|
||||||
|
|
||||||
def _private_ocr(self, imgpath):
|
def _private_ocr(self, imgpath):
|
||||||
|
if self.needinit:
|
||||||
|
self.level2init()
|
||||||
|
try:
|
||||||
text = self.ocr(imgpath)
|
text = self.ocr(imgpath)
|
||||||
|
except Exception as e:
|
||||||
|
self.needinit = True
|
||||||
|
raise e
|
||||||
return self._100_f(text)
|
return self._100_f(text)
|
||||||
|
|
||||||
def _100_f(self, line):
|
def _100_f(self, line):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user