( projectId = 'YOUR_PROJECT_ID', location = 'us-central1', datasetId = 'YOUR_DATASET_ID' )
| 15 | 'use strict'; |
| 16 | |
| 17 | function main( |
| 18 | projectId = 'YOUR_PROJECT_ID', |
| 19 | location = 'us-central1', |
| 20 | datasetId = 'YOUR_DATASET_ID' |
| 21 | ) { |
| 22 | // [START automl_vision_classification_get_dataset] |
| 23 | // [START automl_vision_object_detection_get_dataset] |
| 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 datasetId = 'YOUR_DATASET_ID'; |
| 30 | |
| 31 | // Imports the Google Cloud AutoML library |
| 32 | const {AutoMlClient} = require('@google-cloud/automl').v1; |
| 33 | |
| 34 | // Instantiates a client |
| 35 | const client = new AutoMlClient(); |
| 36 | |
| 37 | async function getDataset() { |
| 38 | // Construct request |
| 39 | const request = { |
| 40 | name: client.datasetPath(projectId, location, datasetId), |
| 41 | }; |
| 42 | |
| 43 | const [response] = await client.getDataset(request); |
| 44 | |
| 45 | console.log(`Dataset name: ${response.name}`); |
| 46 | console.log( |
| 47 | `Dataset id: ${ |
| 48 | response.name.split('/')[response.name.split('/').length - 1] |
| 49 | }` |
| 50 | ); |
| 51 | console.log(`Dataset display name: ${response.displayName}`); |
| 52 | console.log('Dataset create time'); |
| 53 | console.log(`\tseconds ${response.createTime.seconds}`); |
| 54 | console.log(`\tnanos ${response.createTime.nanos / 1e9}`); |
| 55 | // [END automl_vision_classification_get_dataset] |
| 56 | // [END automl_vision_object_detection_get_dataset] |
| 57 | console.log( |
| 58 | `Text extraction dataset metadata: ${response.textExtractionDatasetMetadata}` |
| 59 | ); |
| 60 | |
| 61 | console.log( |
| 62 | `Text sentiment dataset metadata: ${response.textSentimentDatasetMetadata}` |
| 63 | ); |
| 64 | |
| 65 | console.log( |
| 66 | `Text classification dataset metadata: ${response.textClassificationDatasetMetadata}` |
| 67 | ); |
| 68 | |
| 69 | if (response.translationDatasetMetadata !== undefined) { |
| 70 | console.log('Translation dataset metadata:'); |
| 71 | console.log( |
| 72 | `\tSource language code: ${response.translationDatasetMetadata.sourceLanguageCode}` |
| 73 | ); |
| 74 | console.log( |
no test coverage detected