From 33c19f91124967092864a210449a9a5bf923e4fa Mon Sep 17 00:00:00 2001 From: Wojciech Jarmosz Date: Sun, 23 May 2021 18:04:09 +0200 Subject: [PATCH] Add tensor --- mlflow_prediction.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mlflow_prediction.py b/mlflow_prediction.py index e1a8140..32c7efb 100644 --- a/mlflow_prediction.py +++ b/mlflow_prediction.py @@ -1,6 +1,8 @@ import json import mlflow +import torch +import numpy as np import pandas as pd import sys @@ -14,5 +16,4 @@ 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]))) \ No newline at end of file +print(model(torch.tensor(np.array(json_data['inputs'])).float())) \ No newline at end of file