ium_s449288/predict_registry.py

15 lines
445 B
Python
Raw Normal View History

2022-05-14 13:03:16 +02:00
import mlflow
import numpy as np
import json
2022-05-14 14:56:26 +02:00
registry_path = '/mlruns/17/4a8894c60fe34adcb79108c66d7330fc/artifacts/linear-model'
model = mlflow.pyfunc.load_model(registry_path)
2022-05-14 13:03:16 +02:00
2022-05-14 14:36:50 +02:00
with open(f'{registry_path}/input_example.json') as f:
2022-05-14 13:03:16 +02:00
input_example_data = json.load(f)
2022-05-14 14:56:26 +02:00
input_example = np.array(input_example_data['inputs']).reshape(-1, 8)
2022-05-14 13:03:16 +02:00
print(f'Input example: {input_example}')
print(f'Model prediction: {model.predict(input_example)}')