ium_444409/predict_s444356.py

15 lines
400 B
Python
Raw Normal View History

2022-05-11 18:19:02 +02:00
import json
import mlflow
import numpy as np
2022-05-11 19:12:25 +02:00
logged_model = 'mlruns/1/296d6f314bb2451885fb7ae58988301e/artifacts/model'
2022-05-11 18:19:02 +02:00
loaded_model = mlflow.pyfunc.load_model(logged_model)
with open(f'{logged_model}/input_example.json') as f:
data = json.load(f)
2022-05-11 18:34:08 +02:00
input_example = np.array([data['inputs'][0]], dtype=np.float64).reshape(-1, 2)
2022-05-11 18:19:02 +02:00
2022-05-11 18:34:08 +02:00
print(f'Prediction: {loaded_model.predict(input_example)}')