ium_434704/mlflow_prediction.py
Wojciech Jarmosz 99aa9a85a0
Some checks failed
s434704-predict-s426206/pipeline/head There was a failure building this commit
s434704-evaluation/pipeline/head This commit looks good
Fix prediction script
2021-05-23 18:28:44 +02:00

20 lines
346 B
Python

import json
import mlflow
import torch
import numpy as np
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']
print(model(torch.tensor(np.array(json_data['inputs'])).float()))