ium_444507/lab08_predict.py

15 lines
384 B
Python
Raw Permalink Normal View History

2022-05-16 07:34:02 +02:00
import json
2022-05-16 03:02:18 +02:00
import mlflow
import numpy as np
logged_model = 'mlruns/1/4b83e774512444188fb587288818c298/artifacts/model'
2022-05-16 07:34:02 +02:00
loaded_model = mlflow.pyfunc.load_model(logged_model)
2022-05-16 03:02:18 +02:00
2022-05-16 07:34:02 +02:00
with open('input_example.json') as f:
2022-05-16 03:02:18 +02:00
data = json.load(f)
2022-05-16 07:34:02 +02:00
input_example = np.array([data['inputs'][0]], dtype=np.float64).reshape(-1, 2)
2022-05-16 03:02:18 +02:00
2022-05-16 07:34:02 +02:00
print(f'Prediction: {loaded_model.predict(input_example)}')