def get_model_content_from_file(file_name: str, model_type: str, params={}): if 'inputs' in params and 'outputs' in params: return { SerializationHelper.__model_file_name_map.get(model_type, 'model'): open(file_name, 'rb') } return FileHelper.get_compressed_tar_file_content( file_name, SerializationHelper.get_list_of_model_file_content(model_type, params) )
def get_model_from_file(self, file_name: str): self.__model_file_content = FileHelper.get_compressed_tar_file_content( file_name, ['init_net.pb', 'predict_net.pb', 'input_spec.json', 'output_spec.json'] ) return workspace.Predictor(self.__model_file_content['init_net.pb'], self.__model_file_content['predict_net.pb'])