( projectId = 'YOUR_PROJECT_ID', location = 'us-central1', datasetId = 'YOUR_DATASET_ID', displayName = 'YOUR_DISPLAY_NAME' )
| 15 | 'use strict'; |
| 16 | |
| 17 | function main( |
| 18 | projectId = 'YOUR_PROJECT_ID', |
| 19 | location = 'us-central1', |
| 20 | datasetId = 'YOUR_DATASET_ID', |
| 21 | displayName = 'YOUR_DISPLAY_NAME' |
| 22 | ) { |
| 23 | // [START automl_translate_create_model] |
| 24 | /** |
| 25 | * TODO(developer): Uncomment these variables before running the sample. |
| 26 | */ |
| 27 | // const projectId = 'YOUR_PROJECT_ID'; |
| 28 | // const location = 'us-central1'; |
| 29 | // const dataset_id = 'YOUR_DATASET_ID'; |
| 30 | // const displayName = 'YOUR_DISPLAY_NAME'; |
| 31 | |
| 32 | // Imports the Google Cloud AutoML library |
| 33 | const {AutoMlClient} = require('@google-cloud/automl').v1; |
| 34 | |
| 35 | // Instantiates a client |
| 36 | const client = new AutoMlClient(); |
| 37 | |
| 38 | async function createModel() { |
| 39 | // Construct request |
| 40 | const request = { |
| 41 | parent: client.locationPath(projectId, location), |
| 42 | model: { |
| 43 | displayName: displayName, |
| 44 | datasetId: datasetId, |
| 45 | translationModelMetadata: {}, |
| 46 | }, |
| 47 | }; |
| 48 | |
| 49 | // Don't wait for the LRO |
| 50 | const [operation] = await client.createModel(request); |
| 51 | console.log('Training started...'); |
| 52 | console.log(`Training operation name: ${operation.name}`); |
| 53 | } |
| 54 | |
| 55 | createModel(); |
| 56 | // [END automl_translate_create_model] |
| 57 | } |
| 58 | |
| 59 | process.on('unhandledRejection', err => { |
| 60 | console.error(err.message); |
no test coverage detected