2021-05-24 00:57:03 +02:00
|
|
|
from mlflow.tracking import MlflowClient
|
|
|
|
import mlflow
|
|
|
|
import pandas as pd
|
|
|
|
|
|
|
|
mlflow.set_tracking_uri("http://172.17.0.1:5000")
|
|
|
|
client = MlflowClient()
|
2021-05-27 12:51:55 +02:00
|
|
|
version = 0
|
2021-05-27 12:56:56 +02:00
|
|
|
model_name = "s434788"
|
2021-05-27 12:50:10 +02:00
|
|
|
for mv in client.search_model_versions(f"name='{model_name}'"):
|
2021-05-27 12:51:55 +02:00
|
|
|
print(mv)
|
2021-05-27 12:50:10 +02:00
|
|
|
if int(mv.version) > version:
|
|
|
|
version = int(mv.version)
|
2021-05-24 00:57:03 +02:00
|
|
|
|
2021-05-27 12:48:20 +02:00
|
|
|
print(f"selected version {version}")
|
|
|
|
|
|
|
|
print(f"I will search for URI: models:/{model_name}/{version}")
|
|
|
|
|
2021-05-24 01:01:49 +02:00
|
|
|
model = mlflow.keras.load_model(
|
2021-05-24 00:57:03 +02:00
|
|
|
model_uri=f"models:/{model_name}/{version}"
|
|
|
|
)
|
|
|
|
|
2021-05-27 13:15:32 +02:00
|
|
|
data = pd.read_json('my_model/input_example.json', orient='index')
|
2021-05-24 00:57:03 +02:00
|
|
|
|
|
|
|
print(data)
|
|
|
|
print(model.predict(data))
|