Spaces:
Running
Running
manivannan023
commited on
Commit
•
a8ffb23
1
Parent(s):
4f23d5f
Update model_inference/model_inference.py
Browse files
model_inference/model_inference.py
CHANGED
@@ -1,15 +1,14 @@
|
|
1 |
# from utils.load_model import load_model
|
2 |
from feature_construction.feature_construction import FeatureConstructor
|
3 |
import pandas as pd
|
4 |
-
|
5 |
|
6 |
|
7 |
def predict(loaded_model, x: pd.DataFrame, predict_proba: bool = True,
|
8 |
use_deployed_model: bool = True, model_file_name: str = None, predict_label: bool = False):
|
9 |
prediction = None
|
10 |
-
logger = MongoLogger()
|
11 |
try:
|
12 |
-
|
13 |
# loaded_model = load_model(load_deployed_model=use_deployed_model, model_file_name=model_file_name)
|
14 |
|
15 |
if loaded_model is not None:
|
@@ -70,8 +69,8 @@ def predict(loaded_model, x: pd.DataFrame, predict_proba: bool = True,
|
|
70 |
prediction = label_encoder.inverse_transform(prediction)
|
71 |
|
72 |
except Exception as e:
|
73 |
-
|
74 |
raise
|
75 |
-
|
76 |
|
77 |
return prediction
|
|
|
1 |
# from utils.load_model import load_model
|
2 |
from feature_construction.feature_construction import FeatureConstructor
|
3 |
import pandas as pd
|
4 |
+
import logging
|
5 |
|
6 |
|
7 |
def predict(loaded_model, x: pd.DataFrame, predict_proba: bool = True,
|
8 |
use_deployed_model: bool = True, model_file_name: str = None, predict_label: bool = False):
|
9 |
prediction = None
|
|
|
10 |
try:
|
11 |
+
logging.warning("entering model_inference.predict")
|
12 |
# loaded_model = load_model(load_deployed_model=use_deployed_model, model_file_name=model_file_name)
|
13 |
|
14 |
if loaded_model is not None:
|
|
|
69 |
prediction = label_encoder.inverse_transform(prediction)
|
70 |
|
71 |
except Exception as e:
|
72 |
+
logging.warning(f"unexpected model_inference.predict error: {e}")
|
73 |
raise
|
74 |
+
logging.warning("exiting model_inference.predict")
|
75 |
|
76 |
return prediction
|