ium_478841/scripts/predict_s444356_registry.py

13 lines
453 B
Python
Raw Normal View History

2022-05-15 12:33:21 +02:00
import mlflow
import numpy as np
import json
2022-05-15 12:50:04 +02:00
import os
2022-05-15 12:33:21 +02:00
2022-05-15 12:50:04 +02:00
print('################\n\n', os.listdir(), "\n\n###############")
2022-05-15 12:33:21 +02:00
model = mlflow.pyfunc.load_model(
'mlruns/13/da5c6167bb45403fa35569849a1fbc13/artifacts/model')
with open('mlruns/13/da5c6167bb45403fa35569849a1fbc13/artifacts/model/input_example.json') as f:
2022-05-15 12:59:27 +02:00
data = np.array([json.load(f)['inputs'][0]], dtype=np.float64)
2022-05-15 12:33:21 +02:00
print(f"Predicted values: {model.predict(data.reshape(-1, 2))}")