Fix module downloading
This commit is contained in:
@@ -47,6 +47,7 @@ except ImportError:
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
from rapidocr_onnxruntime import RapidOCR as ROCR
|
from rapidocr_onnxruntime import RapidOCR as ROCR
|
||||||
|
import urllib.request
|
||||||
except ImportError:
|
except ImportError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@@ -434,8 +435,8 @@ class RapidOCR:
|
|||||||
if not os.path.isfile(rapidocr_model_file):
|
if not os.path.isfile(rapidocr_model_file):
|
||||||
logger.info('Downloading RapidOCR model')
|
logger.info('Downloading RapidOCR model')
|
||||||
try:
|
try:
|
||||||
urllib.request.urlretrieve('https://raw.githubusercontent.com/AuroraWright/owocr/master/rapidocr_japan_PP-OCRv4_rec_infer.onnx', rapidocr_model_file)
|
urllib.request.urlretrieve('https://github.com/AuroraWright/owocr/raw/master/rapidocr_japan_PP-OCRv4_rec_infer.onnx', rapidocr_model_file)
|
||||||
except Exception as inst:
|
except:
|
||||||
logger.warning('Download failed. RapidOCR will not work!')
|
logger.warning('Download failed. RapidOCR will not work!')
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user