コード例 #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
ファイル: model.py プロジェクト: animator/orange3-scoring
 def fromPMML(cls, pmmlDoc):
     from pypmml import Model
     model = Model.fromString(pmmlDoc)
     return cls(model, "PMML")