ium_444356/predict.py

16 lines
402 B
Python
Raw Normal View History

import json
import mlflow
2022-05-11 20:05:49 +02:00
import sys
2022-05-11 20:10:38 +02:00
import numpy as np
2022-05-11 21:19:17 +02:00
#input = sys.argv[1]
2022-05-11 20:03:13 +02:00
2022-05-11 20:05:49 +02:00
logged_model = 'mlruns/1/70439eb482b54d56b54b0ecc6f1ca96f/artifacts/s444409'
2022-05-11 19:33:00 +02:00
loaded_model = mlflow.pyfunc.load_model(logged_model)
2022-05-11 21:16:05 +02:00
with open('input_example.json') as f:
data = json.load(f)
2022-05-11 20:18:32 +02:00
input_example = np.array([data['inputs'][0]], dtype=np.float32)
print(f'Prediction: {loaded_model.predict(input_example)}')