After deploying and making predictions, you can manually undeploy your model to avoid incurring further charges.
Undeploy code samples
Web UI
Open the Vision Dashboard and select the Models tab (with lightbulb icon) in the left navigation bar to display the available models.
To view the models for a different project, select the project from the drop-down list in the upper right of the title bar.
- Select the row for the model you want to use to label your images.
- Select the Test & Use tab just below the title bar.
-
Select Remove deployment from the banner beneath your model name to open the undeploy option window.
-
Select Remove deployment to undeploy the model.
-
You will receive an email when model undeployment has completed.
REST
Before using any of the request data, make the following replacements:
- project-id: your GCP project ID.
- model-id: the ID of your model, from the
response when you created the model. The ID is the last element of the name of your model.
For example:
- model name:
projects/project-id/locations/location-id/models/IOD4412217016962778756
- model id:
IOD4412217016962778756
- model name:
HTTP method and URL:
POST https://automl.googleapis.com/v1/projects/PROJECT_ID/locations/us- central1/models/MODEL_ID:undeploy
To send your request, choose one of these options:
curl
Execute the following command:
curl -X POST \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "x-goog-user-project: project-id" \
-H "Content-Type: application/json; charset=utf-8" \
-d "" \
"https://automl.googleapis.com/v1/projects/PROJECT_ID/locations/us- central1/models/MODEL_ID:undeploy"
PowerShell
Execute the following command:
$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred"; "x-goog-user-project" = "project-id" }
Invoke-WebRequest `
-Method POST `
-Headers $headers `
-Uri "https://automl.googleapis.com/v1/projects/PROJECT_ID/locations/us- central1/models/MODEL_ID:undeploy" | Select-Object -Expand Content
{ "name": "projects/PROJECT_ID/locations/us-central1/operations/OPERATION_ID", "metadata": { "@type": "type.googleapis.com/google.cloud.automl.v1.OperationMetadata", "createTime": "2019-08-07T22:19:50.828033Z", "updateTime": "2019-08-07T22:19:50.828033Z", "undeployModelDetails": {} } }
You can get the status of an operation with the following HTTP method and URL:
GET https://automl.googleapis.com/v1/projects/PROJECT_ID/locations/us-central1/operations/OPERATION_ID
The status of a finished operation will look similar to the following:
{ "name": "projects/PROJECT_ID/locations/us-central1/operations/OPERATION_ID", "metadata": { "@type": "type.googleapis.com/google.cloud.automl.v1.OperationMetadata", "createTime": "2019-06-21T16:47:21.704674Z", "updateTime": "2019-06-21T17:01:00.802505Z", "deployModelDetails": {} }, "done": true, "response": { "@type": "type.googleapis.com/google.protobuf.Empty" } }
Go
Before trying this sample, follow the setup instructions for this language on the Client Libraries page.
Java
Before trying this sample, follow the setup instructions for this language on the Client Libraries page.
Node.js
Before trying this sample, follow the setup instructions for this language on the Client Libraries page.
Python
Before trying this sample, follow the setup instructions for this language on the Client Libraries page.
Additional languages
C#: Please follow the C# setup instructions on the client libraries page and then visit the AutoML Vision reference documentation for .NET.
PHP: Please follow the PHP setup instructions on the client libraries page and then visit the AutoML Vision reference documentation for PHP.
Ruby: Please follow the Ruby setup instructions on the client libraries page and then visit the AutoML Vision reference documentation for Ruby.