ium_444417/lab8/predictArtifact.py

14 lines
438 B
Python
Raw Normal View History

2022-05-15 12:45:33 +02:00
import mlflow
import numpy as np
import json
2022-05-15 16:56:14 +02:00
logged_model = 'mlrunsArtifact/1/6b2323cf51794581bf1e2f6d060d50f6/artifacts/model'
2022-05-15 12:45:33 +02:00
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)}')