use of com.google.cloud.automl.v1beta1.UndeployModelRequest in project java-automl by googleapis.
the class UndeployModel method undeployModel.
// Undeploy a model from prediction
static void undeployModel(String projectId, String modelId) throws IOException, ExecutionException, InterruptedException {
// the "close" method on the client to safely clean up any remaining background resources.
try (AutoMlClient client = AutoMlClient.create()) {
// Get the full path of the model.
ModelName modelFullId = ModelName.of(projectId, "us-central1", modelId);
UndeployModelRequest request = UndeployModelRequest.newBuilder().setName(modelFullId.toString()).build();
OperationFuture<Empty, OperationMetadata> future = client.undeployModelAsync(request);
future.get();
System.out.println("Model undeployment finished");
}
}
use of com.google.cloud.automl.v1beta1.UndeployModelRequest in project java-automl by googleapis.
the class ClassificationUndeployModel method classificationUndeployModel.
// Deploy a model
static void classificationUndeployModel(String projectId, String modelId) throws IOException, ExecutionException, InterruptedException {
// the "close" method on the client to safely clean up any remaining background resources.
try (AutoMlClient client = AutoMlClient.create()) {
// Get the full path of the model.
ModelName modelFullId = ModelName.of(projectId, "us-central1", modelId);
// Build deploy model request.
UndeployModelRequest undeployModelRequest = UndeployModelRequest.newBuilder().setName(modelFullId.toString()).build();
// Deploy a model with the deploy model request.
OperationFuture<Empty, OperationMetadata> future = client.undeployModelAsync(undeployModelRequest);
future.get();
// Display the deployment details of model.
System.out.println("Model undeploy finished");
}
}
use of com.google.cloud.automl.v1beta1.UndeployModelRequest in project java-automl by googleapis.
the class UndeployModel method undeployModel.
// Undeploy a model from prediction
static void undeployModel(String projectId, String modelId) throws IOException, ExecutionException, InterruptedException {
// the "close" method on the client to safely clean up any remaining background resources.
try (AutoMlClient client = AutoMlClient.create()) {
// Get the full path of the model.
ModelName modelFullId = ModelName.of(projectId, "us-central1", modelId);
UndeployModelRequest request = UndeployModelRequest.newBuilder().setName(modelFullId.toString()).build();
OperationFuture<Empty, OperationMetadata> future = client.undeployModelAsync(request);
future.get();
System.out.println("Model undeployment finished");
}
}
use of com.google.cloud.automl.v1beta1.UndeployModelRequest in project java-automl by googleapis.
the class ClassificationUndeployModel method classificationUndeployModel.
// Deploy a model
static void classificationUndeployModel(String projectId, String modelId) throws IOException, ExecutionException, InterruptedException {
// the "close" method on the client to safely clean up any remaining background resources.
try (AutoMlClient client = AutoMlClient.create()) {
// Get the full path of the model.
ModelName modelFullId = ModelName.of(projectId, "us-central1", modelId);
// Build deploy model request.
UndeployModelRequest undeployModelRequest = UndeployModelRequest.newBuilder().setName(modelFullId.toString()).build();
// Deploy a model with the deploy model request.
OperationFuture<Empty, OperationMetadata> future = client.undeployModelAsync(undeployModelRequest);
future.get();
// Display the deployment details of model.
System.out.println("Model undeploy finished");
}
}
Aggregations