chore(rapidocr_onnxruntime): change read_yaml order (#251)

fisrt check the input args 
if the param named 'config_path'  exists, use 'config_path' first.
if it is not exists, use the default one named 'DEFAULT_CFG_PATH'
This commit is contained in:
Pumpkinor authored and GitHub committed 2024-11-13 08:21:20 +08:00
1 parent 0de20668af
commit f7978c650b
1 file changed
+3 -3
+3 -3
View File
@@ -31,11 +31,11 @@ logger = get_logger("RapidOCR")
class RapidOCR:
def __init__(self, config_path: Optional[str] = None, **kwargs):
config = read_yaml(DEFAULT_CFG_PATH)
config = update_model_path(config)
if config_path is not None and Path(config_path).exists:
config = read_yaml(config_path)
else:
config = read_yaml(DEFAULT_CFG_PATH)
config = update_model_path(config)
if kwargs:
updater = UpdateParameters()