2021-05-23 21:42:55 +02:00
|
|
|
|
|
|
|
import json
|
|
|
|
import mlflow
|
|
|
|
from mlflow.tracking import MlflowClient
|
|
|
|
import mlflow.pyfunc
|
|
|
|
import torch
|
|
|
|
import numpy as np
|
|
|
|
import pandas as pd
|
|
|
|
|
|
|
|
import sys
|
|
|
|
|
|
|
|
arguments = sys.argv[1:]
|
|
|
|
|
|
|
|
mlflow.set_tracking_uri("http://172.17.0.1:5000")
|
|
|
|
client = MlflowClient()
|
2021-05-23 22:38:08 +02:00
|
|
|
model_version = 1
|
2021-05-23 21:54:03 +02:00
|
|
|
model_name = "s426206"
|
2021-05-23 21:42:55 +02:00
|
|
|
|
|
|
|
input = str(arguments[0])
|
|
|
|
|
|
|
|
model = mlflow.pyfunc.load_model(
|
|
|
|
model_uri=f"models:/{model_name}/{model_version}"
|
|
|
|
)
|
|
|
|
|
|
|
|
with open(f'{model_name}/{input}', 'r') as file:
|
|
|
|
json_data = json.load(file)
|
|
|
|
|
|
|
|
print(model(torch.tensor(np.array(json_data['inputs'])).float()))
|