Skip to content

Commit

Permalink
Log messages as debug
Browse files Browse the repository at this point in the history
  • Loading branch information
Adrian Gonzalez-Martin committed Sep 11, 2020
1 parent ca77f9a commit be9055e
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions servers/mlflowserver/mlflowserver/MLFlowServer.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
import numpy as np
import yaml
import os
import logging
import requests
import numpy as np
import pandas as pd

from mlflow import pyfunc
from seldon_core import Storage
from seldon_core.user_model import SeldonComponent
from typing import Dict, List, Union, Iterable
import yaml
import os
from typing import Dict, List, Union

logger = logging.getLogger()

MLFLOW_SERVER = "model"


class MLFlowServer(SeldonComponent):
def __init__(self, model_uri: str, xtype: str = 'ndarray'):
def __init__(self, model_uri: str, xtype: str = "ndarray"):
super().__init__()
logger.info(f"Creating MLFLow server with URI {model_uri}")
logger.info(f"xtype: {xtype}")
Expand All @@ -30,9 +31,9 @@ def load(self):
self.ready = True

def predict(
self, X: np.ndarray, feature_names: Iterable[str] = [], meta: Dict = None
self, X: np.ndarray, feature_names: List[str] = [], meta: Dict = None
) -> Union[np.ndarray, List, Dict, str, bytes]:
logger.info(f"Requesting prediction with: {X}")
logger.debug(f"Requesting prediction with: {X}")

if not self.ready:
raise requests.HTTPError("Model not loaded yet")
Expand All @@ -45,7 +46,8 @@ def predict(
else:
df = pd.DataFrame(data=X)
result = self._model.predict(df)
logger.info(f"Prediction result: {result}")

logger.debug(f"Prediction result: {result}")
return result

def init_metadata(self):
Expand Down

0 comments on commit be9055e

Please sign in to comment.