ium_444354/predictMlflow.py
Adrian Charkiewicz bdf10f8606 lab8
2022-05-15 19:20:14 +02:00

14 lines
431 B
Python

import mlflow
import numpy as np
import json
logged_model = '/mlruns/20/80fe21a0804844088147d15a3cebb3e5/artifacts/lego'
loaded_model = mlflow.pyfunc.load_model(logged_model)
with open(f'{logged_model}/input_example.json') as f:
input_example_data = json.load(f)
input_example = np.array(input_example_data['inputs']).reshape(-1,)
print(f'Input: {input_example}')
print(f'Prediction: {loaded_model.predict(input_example)}')