Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import kfserving
from typing import List, Dict
import numpy as np
from alibi_detect.utils.saving import load_tf_model
import argparse
class SignsModel(kfserving.KFModel):
def __init__(self, name: str, model_dir: str):
super().__init__(name)
self.model_dir = model_dir
self.name = name
self.ready = False
def load(self):
self.model = load_tf_model(self.model_dir)
self.ready = True
def predict(self, request: Dict) -> Dict:
inputs = np.array(request["instances"])
try:
preds = self.model.predict(inputs)
print(preds)
import kfserving
from typing import List, Dict
import numpy as np
from alibi_detect.utils.saving import load_tf_model
import argparse
class MnistModel(kfserving.KFModel):
def __init__(self, name: str, model_dir: str):
super().__init__(name)
self.model_dir = model_dir
self.name = name
self.ready = False
def load(self):
self.model = load_tf_model(self.model_dir)
self.ready = True
def predict(self, request: Dict) -> Dict:
inputs = np.array(request["instances"])
try:
preds = self.model.predict(inputs)
print(preds)