ium_444417/lab8/predictMlflow.py

14 lines
437 B
Python
Raw Normal View History

2022-05-15 10:37:28 +02:00
import mlflow
import numpy as np
import json
2022-05-15 12:45:33 +02:00
logged_model = '/mlruns/14/80fe21a0804844088147d15a3cebb3e5/artifacts/lego-model'
loaded_model = mlflow.pyfunc.load_model(logged_model)
2022-05-15 10:37:28 +02:00
2022-05-15 12:45:33 +02:00
with open(f'{logged_model}/input_example.json') as f:
2022-05-15 10:37:28 +02:00
input_example_data = json.load(f)
2022-05-15 11:05:05 +02:00
input_example = np.array(input_example_data['inputs']).reshape(-1,)
2022-05-15 10:55:01 +02:00
print(f'Input: {input_example}')
2022-05-15 12:45:33 +02:00
print(f'Prediction: {loaded_model.predict(input_example)}')