Diese Seite wurde von der Cloud Translation API übersetzt.
Switch to English

Modell löschen

Modell löschen.



 * Demonstrates using the AutoML client to delete a model.
 * @param projectId the Id of the project.
 * @param computeRegion the Region name.
 * @param modelId the Id of the model.
 * @throws Exception on AutoML Client errors
public static void deleteModel(String projectId, String computeRegion, String modelId)
    throws InterruptedException, ExecutionException, IOException {
  // Instantiates a client
  try (AutoMlClient client = AutoMlClient.create()) {

    // Get the full path of the model.
    ModelName modelFullId = ModelName.of(projectId, computeRegion, modelId);

    // Delete a model.
    Empty response = client.deleteModelAsync(modelFullId).get();

    System.out.println("Model deletion started...");


    # TODO(developer): Uncomment and set the following variables
    # project_id = 'PROJECT_ID_HERE'
    # compute_region = 'COMPUTE_REGION_HERE'
    # model_id = 'MODEL_ID_HERE'

    from google.cloud import automl_v1beta1 as automl

    client = automl.AutoMlClient()

    # Get the full path of the model.
    model_full_id = client.model_path(project_id, compute_region, model_id)

    # Delete a model.
    response = client.delete_model(name=model_full_id)

    # synchronous check of operation status.
    print("Model deleted. {}".format(response.result()))