ium_444507/lab08_predict_from_registry.py
Adam Wojdyla fad30cde27
Some checks failed
s444507-predict-s444356/pipeline/head This commit looks good
s444507-evaluation/pipeline/head This commit looks good
444507-training/pipeline/head There was a failure building this commit
predict from registry
2022-05-16 09:03:45 +02:00

15 lines
402 B
Python

import json
import mlflow
import numpy as np
logged_model = '/mlruns/13/da5c6167bb45403fa35569849a1fbc13/artifacts/model'
loaded_model = mlflow.pyfunc.load_model(logged_model)
with open(f'{logged_model}/input_example.json') as f:
data = json.load(f)
input_example = np.array([data['inputs'][0]], dtype=np.float64).reshape(-1, 2)
print(f'Prediction: {loaded_model.predict(input_example)}')