Exemple #1
0
    def get_model(cls, dict_of_path):
        # Use default
        if not dict_of_path:
            default_path = os.path.join(LibraryUtil.get_res_dir(), 'char', 'ocr', 'en.json')
            model = ReadUtil.read_json(default_path)
            return nmc.Ocr(model=model)

        # Use dict
        if type(dict_of_path) is dict:
            return nmc.Ocr(model=dict_of_path)

        # Use json from file
        model = ReadUtil.read_json(dict_of_path)
        if not model:
            raise ValueError('The dict_of_path does not exist. Please check "{}"'.format(dict_of_path))
        return nmc.Ocr(model=model)
Exemple #2
0
 def get_model(cls):
     return nmc.Ocr()