示例#1
0
文件: ml.py 项目: overad/daas-client
    def is_support(self):
        try:
            from pypmml import Model

            model_content = self.model
            if isinstance(model_content, (bytes, bytearray)):
                model_content = model_content.decode('utf-8')

            if isinstance(model_content, str):
                # Check if a file path
                if os.path.exists(model_content):
                    self.pmml_model = Model.fromFile(model_content)
                else:
                    self.pmml_model = Model.fromString(model_content)
                return True
            else:
                Model.close()
                return False
        except Exception as e:
            return False
示例#2
0
 def fromPMML(cls, pmmlDoc):
     from pypmml import Model
     model = Model.fromString(pmmlDoc)
     return cls(model, "PMML")