Add tensor
Some checks failed
s434704-predict-s426206/pipeline/head There was a failure building this commit
s434704-training/pipeline/head This commit looks good

This commit is contained in:
Wojciech Jarmosz 2021-05-23 18:04:09 +02:00
parent fa55fe7670
commit 33c19f9112

View File

@ -1,6 +1,8 @@
import json import json
import mlflow import mlflow
import torch
import numpy as np
import pandas as pd import pandas as pd
import sys import sys
@ -14,5 +16,4 @@ model = mlflow.pytorch.load_model("my_model")
with open(f'my_model/{input}', 'r') as file: with open(f'my_model/{input}', 'r') as file:
json_data = json.load(file)['inputs'] json_data = json.load(file)['inputs']
data_into_dict = {idx:x for idx, x in enumerate(json_data)} print(model(torch.tensor(np.array(json_data['inputs'])).float()))
print(model(pd.DataFrame([data_into_dict])))