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
def fromPMML(cls, pmmlDoc): from pypmml import Model model = Model.fromString(pmmlDoc) return cls(model, "PMML")