ium_434704/mlflow_prediction.py
Wojciech Jarmosz fa55fe7670
Some checks failed
s434704-predict-s426206/pipeline/head There was a failure building this commit
Add model prediction
2021-05-23 17:44:24 +02:00

18 lines
352 B
Python

import json
import mlflow
import pandas as pd
import sys
arguments = sys.argv[1:]
input = str(arguments[0])
model = mlflow.pytorch.load_model("my_model")
with open(f'my_model/{input}', 'r') as file:
json_data = json.load(file)['inputs']
data_into_dict = {idx:x for idx, x in enumerate(json_data)}
print(model(pd.DataFrame([data_into_dict])))