( projectId = 'YOUR_PROJECT_ID', location = 'us-central1', modelId = 'YOUR_MODEL_ID' )
| 15 | 'use strict'; |
| 16 | |
| 17 | function main( |
| 18 | projectId = 'YOUR_PROJECT_ID', |
| 19 | location = 'us-central1', |
| 20 | modelId = 'YOUR_MODEL_ID' |
| 21 | ) { |
| 22 | // [START automl_deploy_model] |
| 23 | /** |
| 24 | * TODO(developer): Uncomment these variables before running the sample. |
| 25 | */ |
| 26 | // const projectId = 'YOUR_PROJECT_ID'; |
| 27 | // const location = 'us-central1'; |
| 28 | // const modelId = 'YOUR_MODEL_ID'; |
| 29 | |
| 30 | // Imports the Google Cloud AutoML library |
| 31 | const {AutoMlClient} = require('@google-cloud/automl').v1; |
| 32 | |
| 33 | // Instantiates a client |
| 34 | const client = new AutoMlClient(); |
| 35 | |
| 36 | async function deployModel() { |
| 37 | // Construct request |
| 38 | const request = { |
| 39 | name: client.modelPath(projectId, location, modelId), |
| 40 | }; |
| 41 | |
| 42 | const [operation] = await client.deployModel(request); |
| 43 | |
| 44 | // Wait for operation to complete. |
| 45 | const [response] = await operation.promise(); |
| 46 | console.log(`Model deployment finished. ${response}`); |
| 47 | } |
| 48 | |
| 49 | deployModel(); |
| 50 | // [END automl_deploy_model] |
| 51 | } |
| 52 | |
| 53 | process.on('unhandledRejection', err => { |
| 54 | console.error(err.message); |
no test coverage detected