ium_444517/predict_registry.py

14 lines
353 B
Python

import json
import mlflow
import numpy as np
import sys
PATH = "/mlruns/14/80fe21a0804844088147d15a3cebb3e5/artifacts/lego-model"
model = mlflow.pyfunc.load_model(PATH)
input = str((sys.argv[1:])[0])
with open(f'{PATH}/{input}', 'r') as file:
json_data = json.load(file)
print(f"Prediction: {model.predict(np.array([json_data['inputs']]))}")