From cabcdb3d816fd21bb16467dfeda7a83983f9d62e Mon Sep 17 00:00:00 2001 From: Eric Schmidt Date: Wed, 13 Jan 2021 11:51:18 -0800 Subject: [PATCH] feat(samples): adds samples for enhanced version of library (#16) --- packages/google-cloud-aiplatform/README.md | 16 + .../google-cloud-aiplatform/samples/README.md | 288 ++++++++++++++++++ .../samples/quickstart.js | 6 +- packages/google-cloud-aiplatform/synth.py | 1 + 4 files changed, 309 insertions(+), 2 deletions(-) diff --git a/packages/google-cloud-aiplatform/README.md b/packages/google-cloud-aiplatform/README.md index 583ce63a5b2..765db1e7620 100644 --- a/packages/google-cloud-aiplatform/README.md +++ b/packages/google-cloud-aiplatform/README.md @@ -75,9 +75,25 @@ Samples are in the [`samples/`](https://github.com/googleapis/nodejs-ai-platform | Sample | Source Code | Try it | | --------------------------- | --------------------------------- | ------ | +| Create-batch-prediction-job-video-classification | [source code](https://github.com/googleapis/nodejs-ai-platform/blob/master/samples/create-batch-prediction-job-video-classification.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-ai-platform&page=editor&open_in_editor=samples/create-batch-prediction-job-video-classification.js,samples/README.md) | +| Create-batch-prediction-job-video-object-tracking | [source code](https://github.com/googleapis/nodejs-ai-platform/blob/master/samples/create-batch-prediction-job-video-object-tracking.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-ai-platform&page=editor&open_in_editor=samples/create-batch-prediction-job-video-object-tracking.js,samples/README.md) | | Create-training-pipeline-image-classification | [source code](https://github.com/googleapis/nodejs-ai-platform/blob/master/samples/create-training-pipeline-image-classification.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-ai-platform&page=editor&open_in_editor=samples/create-training-pipeline-image-classification.js,samples/README.md) | +| Create-training-pipeline-image-object-detection | [source code](https://github.com/googleapis/nodejs-ai-platform/blob/master/samples/create-training-pipeline-image-object-detection.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-ai-platform&page=editor&open_in_editor=samples/create-training-pipeline-image-object-detection.js,samples/README.md) | +| Create-training-pipeline-tabular-classification | [source code](https://github.com/googleapis/nodejs-ai-platform/blob/master/samples/create-training-pipeline-tabular-classification.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-ai-platform&page=editor&open_in_editor=samples/create-training-pipeline-tabular-classification.js,samples/README.md) | +| Create-training-pipeline-tabular-regression | [source code](https://github.com/googleapis/nodejs-ai-platform/blob/master/samples/create-training-pipeline-tabular-regression.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-ai-platform&page=editor&open_in_editor=samples/create-training-pipeline-tabular-regression.js,samples/README.md) | +| Create-training-pipeline-text-classification | [source code](https://github.com/googleapis/nodejs-ai-platform/blob/master/samples/create-training-pipeline-text-classification.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-ai-platform&page=editor&open_in_editor=samples/create-training-pipeline-text-classification.js,samples/README.md) | +| Create-training-pipeline-text-entity-extraction | [source code](https://github.com/googleapis/nodejs-ai-platform/blob/master/samples/create-training-pipeline-text-entity-extraction.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-ai-platform&page=editor&open_in_editor=samples/create-training-pipeline-text-entity-extraction.js,samples/README.md) | +| Create-training-pipeline-text-sentiment-analysis | [source code](https://github.com/googleapis/nodejs-ai-platform/blob/master/samples/create-training-pipeline-text-sentiment-analysis.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-ai-platform&page=editor&open_in_editor=samples/create-training-pipeline-text-sentiment-analysis.js,samples/README.md) | +| Create-training-pipeline-video-classification | [source code](https://github.com/googleapis/nodejs-ai-platform/blob/master/samples/create-training-pipeline-video-classification.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-ai-platform&page=editor&open_in_editor=samples/create-training-pipeline-video-classification.js,samples/README.md) | +| Create-training-pipeline-video-object-tracking | [source code](https://github.com/googleapis/nodejs-ai-platform/blob/master/samples/create-training-pipeline-video-object-tracking.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-ai-platform&page=editor&open_in_editor=samples/create-training-pipeline-video-object-tracking.js,samples/README.md) | | List-endpoints | [source code](https://github.com/googleapis/nodejs-ai-platform/blob/master/samples/list-endpoints.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-ai-platform&page=editor&open_in_editor=samples/list-endpoints.js,samples/README.md) | | Predict-image-classification | [source code](https://github.com/googleapis/nodejs-ai-platform/blob/master/samples/predict-image-classification.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-ai-platform&page=editor&open_in_editor=samples/predict-image-classification.js,samples/README.md) | +| Predict-image-object-detection | [source code](https://github.com/googleapis/nodejs-ai-platform/blob/master/samples/predict-image-object-detection.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-ai-platform&page=editor&open_in_editor=samples/predict-image-object-detection.js,samples/README.md) | +| Predict-tabular-classification | [source code](https://github.com/googleapis/nodejs-ai-platform/blob/master/samples/predict-tabular-classification.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-ai-platform&page=editor&open_in_editor=samples/predict-tabular-classification.js,samples/README.md) | +| Predict-tabular-regression | [source code](https://github.com/googleapis/nodejs-ai-platform/blob/master/samples/predict-tabular-regression.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-ai-platform&page=editor&open_in_editor=samples/predict-tabular-regression.js,samples/README.md) | +| Predict-text-classification | [source code](https://github.com/googleapis/nodejs-ai-platform/blob/master/samples/predict-text-classification.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-ai-platform&page=editor&open_in_editor=samples/predict-text-classification.js,samples/README.md) | +| Predict-text-entity-extraction | [source code](https://github.com/googleapis/nodejs-ai-platform/blob/master/samples/predict-text-entity-extraction.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-ai-platform&page=editor&open_in_editor=samples/predict-text-entity-extraction.js,samples/README.md) | +| Predict-text-sentiment-analysis | [source code](https://github.com/googleapis/nodejs-ai-platform/blob/master/samples/predict-text-sentiment-analysis.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-ai-platform&page=editor&open_in_editor=samples/predict-text-sentiment-analysis.js,samples/README.md) | | Quickstart | [source code](https://github.com/googleapis/nodejs-ai-platform/blob/master/samples/quickstart.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-ai-platform&page=editor&open_in_editor=samples/quickstart.js,samples/README.md) | diff --git a/packages/google-cloud-aiplatform/samples/README.md b/packages/google-cloud-aiplatform/samples/README.md index 38f6f984730..00c97365c64 100644 --- a/packages/google-cloud-aiplatform/samples/README.md +++ b/packages/google-cloud-aiplatform/samples/README.md @@ -12,9 +12,25 @@ * [Before you begin](#before-you-begin) * [Samples](#samples) + * [Create-batch-prediction-job-video-classification](#create-batch-prediction-job-video-classification) + * [Create-batch-prediction-job-video-object-tracking](#create-batch-prediction-job-video-object-tracking) * [Create-training-pipeline-image-classification](#create-training-pipeline-image-classification) + * [Create-training-pipeline-image-object-detection](#create-training-pipeline-image-object-detection) + * [Create-training-pipeline-tabular-classification](#create-training-pipeline-tabular-classification) + * [Create-training-pipeline-tabular-regression](#create-training-pipeline-tabular-regression) + * [Create-training-pipeline-text-classification](#create-training-pipeline-text-classification) + * [Create-training-pipeline-text-entity-extraction](#create-training-pipeline-text-entity-extraction) + * [Create-training-pipeline-text-sentiment-analysis](#create-training-pipeline-text-sentiment-analysis) + * [Create-training-pipeline-video-classification](#create-training-pipeline-video-classification) + * [Create-training-pipeline-video-object-tracking](#create-training-pipeline-video-object-tracking) * [List-endpoints](#list-endpoints) * [Predict-image-classification](#predict-image-classification) + * [Predict-image-object-detection](#predict-image-object-detection) + * [Predict-tabular-classification](#predict-tabular-classification) + * [Predict-tabular-regression](#predict-tabular-regression) + * [Predict-text-classification](#predict-text-classification) + * [Predict-text-entity-extraction](#predict-text-entity-extraction) + * [Predict-text-sentiment-analysis](#predict-text-sentiment-analysis) * [Quickstart](#quickstart) ## Before you begin @@ -32,6 +48,40 @@ Before running the samples, make sure you've followed the steps outlined in +### Create-batch-prediction-job-video-classification + +View the [source code](https://github.com/googleapis/nodejs-ai-platform/blob/master/samples/create-batch-prediction-job-video-classification.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-ai-platform&page=editor&open_in_editor=samples/create-batch-prediction-job-video-classification.js,samples/README.md) + +__Usage:__ + + +`node samples/create-batch-prediction-job-video-classification.js` + + +----- + + + + +### Create-batch-prediction-job-video-object-tracking + +View the [source code](https://github.com/googleapis/nodejs-ai-platform/blob/master/samples/create-batch-prediction-job-video-object-tracking.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-ai-platform&page=editor&open_in_editor=samples/create-batch-prediction-job-video-object-tracking.js,samples/README.md) + +__Usage:__ + + +`node samples/create-batch-prediction-job-video-object-tracking.js` + + +----- + + + + ### Create-training-pipeline-image-classification View the [source code](https://github.com/googleapis/nodejs-ai-platform/blob/master/samples/create-training-pipeline-image-classification.js). @@ -49,6 +99,142 @@ __Usage:__ +### Create-training-pipeline-image-object-detection + +View the [source code](https://github.com/googleapis/nodejs-ai-platform/blob/master/samples/create-training-pipeline-image-object-detection.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-ai-platform&page=editor&open_in_editor=samples/create-training-pipeline-image-object-detection.js,samples/README.md) + +__Usage:__ + + +`node samples/create-training-pipeline-image-object-detection.js` + + +----- + + + + +### Create-training-pipeline-tabular-classification + +View the [source code](https://github.com/googleapis/nodejs-ai-platform/blob/master/samples/create-training-pipeline-tabular-classification.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-ai-platform&page=editor&open_in_editor=samples/create-training-pipeline-tabular-classification.js,samples/README.md) + +__Usage:__ + + +`node samples/create-training-pipeline-tabular-classification.js` + + +----- + + + + +### Create-training-pipeline-tabular-regression + +View the [source code](https://github.com/googleapis/nodejs-ai-platform/blob/master/samples/create-training-pipeline-tabular-regression.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-ai-platform&page=editor&open_in_editor=samples/create-training-pipeline-tabular-regression.js,samples/README.md) + +__Usage:__ + + +`node samples/create-training-pipeline-tabular-regression.js` + + +----- + + + + +### Create-training-pipeline-text-classification + +View the [source code](https://github.com/googleapis/nodejs-ai-platform/blob/master/samples/create-training-pipeline-text-classification.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-ai-platform&page=editor&open_in_editor=samples/create-training-pipeline-text-classification.js,samples/README.md) + +__Usage:__ + + +`node samples/create-training-pipeline-text-classification.js` + + +----- + + + + +### Create-training-pipeline-text-entity-extraction + +View the [source code](https://github.com/googleapis/nodejs-ai-platform/blob/master/samples/create-training-pipeline-text-entity-extraction.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-ai-platform&page=editor&open_in_editor=samples/create-training-pipeline-text-entity-extraction.js,samples/README.md) + +__Usage:__ + + +`node samples/create-training-pipeline-text-entity-extraction.js` + + +----- + + + + +### Create-training-pipeline-text-sentiment-analysis + +View the [source code](https://github.com/googleapis/nodejs-ai-platform/blob/master/samples/create-training-pipeline-text-sentiment-analysis.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-ai-platform&page=editor&open_in_editor=samples/create-training-pipeline-text-sentiment-analysis.js,samples/README.md) + +__Usage:__ + + +`node samples/create-training-pipeline-text-sentiment-analysis.js` + + +----- + + + + +### Create-training-pipeline-video-classification + +View the [source code](https://github.com/googleapis/nodejs-ai-platform/blob/master/samples/create-training-pipeline-video-classification.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-ai-platform&page=editor&open_in_editor=samples/create-training-pipeline-video-classification.js,samples/README.md) + +__Usage:__ + + +`node samples/create-training-pipeline-video-classification.js` + + +----- + + + + +### Create-training-pipeline-video-object-tracking + +View the [source code](https://github.com/googleapis/nodejs-ai-platform/blob/master/samples/create-training-pipeline-video-object-tracking.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-ai-platform&page=editor&open_in_editor=samples/create-training-pipeline-video-object-tracking.js,samples/README.md) + +__Usage:__ + + +`node samples/create-training-pipeline-video-object-tracking.js` + + +----- + + + + ### List-endpoints View the [source code](https://github.com/googleapis/nodejs-ai-platform/blob/master/samples/list-endpoints.js). @@ -83,6 +269,108 @@ __Usage:__ +### Predict-image-object-detection + +View the [source code](https://github.com/googleapis/nodejs-ai-platform/blob/master/samples/predict-image-object-detection.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-ai-platform&page=editor&open_in_editor=samples/predict-image-object-detection.js,samples/README.md) + +__Usage:__ + + +`node samples/predict-image-object-detection.js` + + +----- + + + + +### Predict-tabular-classification + +View the [source code](https://github.com/googleapis/nodejs-ai-platform/blob/master/samples/predict-tabular-classification.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-ai-platform&page=editor&open_in_editor=samples/predict-tabular-classification.js,samples/README.md) + +__Usage:__ + + +`node samples/predict-tabular-classification.js` + + +----- + + + + +### Predict-tabular-regression + +View the [source code](https://github.com/googleapis/nodejs-ai-platform/blob/master/samples/predict-tabular-regression.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-ai-platform&page=editor&open_in_editor=samples/predict-tabular-regression.js,samples/README.md) + +__Usage:__ + + +`node samples/predict-tabular-regression.js` + + +----- + + + + +### Predict-text-classification + +View the [source code](https://github.com/googleapis/nodejs-ai-platform/blob/master/samples/predict-text-classification.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-ai-platform&page=editor&open_in_editor=samples/predict-text-classification.js,samples/README.md) + +__Usage:__ + + +`node samples/predict-text-classification.js` + + +----- + + + + +### Predict-text-entity-extraction + +View the [source code](https://github.com/googleapis/nodejs-ai-platform/blob/master/samples/predict-text-entity-extraction.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-ai-platform&page=editor&open_in_editor=samples/predict-text-entity-extraction.js,samples/README.md) + +__Usage:__ + + +`node samples/predict-text-entity-extraction.js` + + +----- + + + + +### Predict-text-sentiment-analysis + +View the [source code](https://github.com/googleapis/nodejs-ai-platform/blob/master/samples/predict-text-sentiment-analysis.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-ai-platform&page=editor&open_in_editor=samples/predict-text-sentiment-analysis.js,samples/README.md) + +__Usage:__ + + +`node samples/predict-text-sentiment-analysis.js` + + +----- + + + + ### Quickstart View the [source code](https://github.com/googleapis/nodejs-ai-platform/blob/master/samples/quickstart.js). diff --git a/packages/google-cloud-aiplatform/samples/quickstart.js b/packages/google-cloud-aiplatform/samples/quickstart.js index abf6279d528..f568c3a26ba 100644 --- a/packages/google-cloud-aiplatform/samples/quickstart.js +++ b/packages/google-cloud-aiplatform/samples/quickstart.js @@ -28,7 +28,9 @@ async function main() { // [END aiplatform_quickstart] } -main(...process.argv.slice(2)).catch(err => { - console.error(err); +process.on('unhandledRejection', err => { + console.error(err.message); process.exitCode = 1; }); + +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-aiplatform/synth.py b/packages/google-cloud-aiplatform/synth.py index d81670c8f72..eb418e42351 100644 --- a/packages/google-cloud-aiplatform/synth.py +++ b/packages/google-cloud-aiplatform/synth.py @@ -23,6 +23,7 @@ # List of excludes for the enhanced library excludes = [ + ".kokoro/presubmit/node12/samples-test.cfg", "package.json", "README.md", "src/decorator.ts",