ium_434704/mlflow_prediction.py

20 lines
336 B
Python
Raw Permalink Normal View History

2021-05-23 16:21:50 +02:00
import json
import mlflow
2021-05-23 18:04:09 +02:00
import torch
import numpy as np
2021-05-23 16:21:50 +02:00
import pandas as pd
import sys
arguments = sys.argv[1:]
input = str(arguments[0])
2021-05-23 17:04:25 +02:00
model = mlflow.pytorch.load_model("my_model")
2021-05-23 16:21:50 +02:00
2021-05-23 17:28:57 +02:00
with open(f'my_model/{input}', 'r') as file:
2021-05-23 18:57:18 +02:00
json_data = json.load(file)
2021-05-23 18:28:44 +02:00
print(model(torch.tensor(np.array(json_data['inputs'])).float()))