Register a Model using the API¶
Registering a model using the API is the same as doing it manually but using python code. This is useful when you want to automate the process of registering models.
In [ ]:
Copied!
import mlflow
MODEL_NAME = "" # 👈 insert the name that you want for your model
RUN_ID = "" # 👈 insert the run id where the model is logged
# Models stored in a run follow this convention
model_path = f"runs:/{RUN_ID}/model"
# register the model
result = mlflow.register_model(model_path, MODEL_NAME)
print(f"✅ Registered model version: {result.version}!")
import mlflow
MODEL_NAME = "" # 👈 insert the name that you want for your model
RUN_ID = "" # 👈 insert the run id where the model is logged
# Models stored in a run follow this convention
model_path = f"runs:/{RUN_ID}/model"
# register the model
result = mlflow.register_model(model_path, MODEL_NAME)
print(f"✅ Registered model version: {result.version}!")