Skip to content

Commit 631d2ea

Browse files
chore: new owl bot post processor docker image (#121)
gcr.io/repo-automation-bots/owlbot-nodejs:latest@sha256:f93bb861d6f12574437bb9aee426b71eafd63b419669ff0ed029f4b7e7162e3f
1 parent feaac09 commit 631d2ea

16 files changed

+70
-92
lines changed

ai-platform/snippets/create-training-pipeline-image-classification.js

+5-7
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,8 @@ function main(
3838
// Imports the Google Cloud Pipeline Service Client library
3939
const aiplatform = require('@google-cloud/aiplatform');
4040

41-
const {
42-
definition,
43-
} = aiplatform.protos.google.cloud.aiplatform.v1.schema.trainingjob;
41+
const {definition} =
42+
aiplatform.protos.google.cloud.aiplatform.v1.schema.trainingjob;
4443
const ModelType = definition.AutoMlImageClassificationInputs.ModelType;
4544

4645
// Specifies the location of the api endpoint
@@ -57,14 +56,13 @@ function main(
5756
const parent = `projects/${project}/locations/${location}`;
5857

5958
// Values should match the input expected by your model.
60-
const trainingTaskInputsMessage = new definition.AutoMlImageClassificationInputs(
61-
{
59+
const trainingTaskInputsMessage =
60+
new definition.AutoMlImageClassificationInputs({
6261
multiLabel: true,
6362
modelType: ModelType.CLOUD,
6463
budgetMilliNodeHours: 8000,
6564
disableEarlyStopping: false,
66-
}
67-
);
65+
});
6866

6967
const trainingTaskInputs = trainingTaskInputsMessage.toValue();
7068

ai-platform/snippets/create-training-pipeline-image-object-detection.js

+5-7
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,8 @@ async function main(
3636
// const location = 'YOUR_PROJECT_LOCATION';
3737

3838
const aiplatform = require('@google-cloud/aiplatform');
39-
const {
40-
definition,
41-
} = aiplatform.protos.google.cloud.aiplatform.v1.schema.trainingjob;
39+
const {definition} =
40+
aiplatform.protos.google.cloud.aiplatform.v1.schema.trainingjob;
4241
const ModelType = definition.AutoMlImageObjectDetectionInputs.ModelType;
4342

4443
// Imports the Google Cloud Pipeline Service Client library
@@ -56,13 +55,12 @@ async function main(
5655
// Configure the parent resource
5756
const parent = `projects/${project}/locations/${location}`;
5857

59-
const trainingTaskInputsObj = new definition.AutoMlImageObjectDetectionInputs(
60-
{
58+
const trainingTaskInputsObj =
59+
new definition.AutoMlImageObjectDetectionInputs({
6160
disableEarlyStopping: false,
6261
modelType: ModelType.CLOUD_HIGH_ACCURACY_1,
6362
budgetMilliNodeHours: 20000,
64-
}
65-
);
63+
});
6664

6765
const trainingTaskInputs = trainingTaskInputsObj.toValue();
6866
const modelToUpload = {displayName: modelDisplayName};

ai-platform/snippets/create-training-pipeline-tabular-classification.js

+2-3
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,8 @@ async function main(
3737
// const project = 'YOUR_PROJECT_ID';
3838
// const location = 'YOUR_PROJECT_LOCATION';
3939
const aiplatform = require('@google-cloud/aiplatform');
40-
const {
41-
definition,
42-
} = aiplatform.protos.google.cloud.aiplatform.v1.schema.trainingjob;
40+
const {definition} =
41+
aiplatform.protos.google.cloud.aiplatform.v1.schema.trainingjob;
4342

4443
// Imports the Google Cloud Pipeline Service Client library
4544
const {PipelineServiceClient} = aiplatform.v1;

ai-platform/snippets/create-training-pipeline-tabular-regression.js

+2-3
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,8 @@ async function main(
3737
// const project = 'YOUR_PROJECT_ID';
3838
// const location = 'YOUR_PROJECT_LOCATION';
3939
const aiplatform = require('@google-cloud/aiplatform');
40-
const {
41-
definition,
42-
} = aiplatform.protos.google.cloud.aiplatform.v1.schema.trainingjob;
40+
const {definition} =
41+
aiplatform.protos.google.cloud.aiplatform.v1.schema.trainingjob;
4342

4443
// Imports the Google Cloud Pipeline Service Client library
4544
const {PipelineServiceClient} = aiplatform.v1;

ai-platform/snippets/create-training-pipeline-text-classification.js

+2-3
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,8 @@ async function main(
3535
// const project = 'YOUR_PROJECT_ID';
3636
// const location = 'YOUR_PROJECT_LOCATION';
3737
const aiplatform = require('@google-cloud/aiplatform');
38-
const {
39-
definition,
40-
} = aiplatform.protos.google.cloud.aiplatform.v1.schema.trainingjob;
38+
const {definition} =
39+
aiplatform.protos.google.cloud.aiplatform.v1.schema.trainingjob;
4140

4241
// Imports the Google Cloud Pipeline Service Client library
4342
const {PipelineServiceClient} = aiplatform.v1;

ai-platform/snippets/create-training-pipeline-text-entity-extraction.js

+2-3
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,8 @@ async function main(
3535
// const project = 'YOUR_PROJECT_ID';
3636
// const location = 'YOUR_PROJECT_LOCATION';
3737
const aiplatform = require('@google-cloud/aiplatform');
38-
const {
39-
definition,
40-
} = aiplatform.protos.google.cloud.aiplatform.v1.schema.trainingjob;
38+
const {definition} =
39+
aiplatform.protos.google.cloud.aiplatform.v1.schema.trainingjob;
4140

4241
// Imports the Google Cloud Pipeline Service Client library
4342
const {PipelineServiceClient} = aiplatform.v1;

ai-platform/snippets/create-training-pipeline-text-sentiment-analysis.js

+2-3
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,8 @@ async function main(
3535
// const project = 'YOUR_PROJECT_ID';
3636
// const location = 'YOUR_PROJECT_LOCATION';
3737
const aiplatform = require('@google-cloud/aiplatform');
38-
const {
39-
definition,
40-
} = aiplatform.protos.google.cloud.aiplatform.v1.schema.trainingjob;
38+
const {definition} =
39+
aiplatform.protos.google.cloud.aiplatform.v1.schema.trainingjob;
4140

4241
// Imports the Google Cloud Pipeline Service Client library
4342
const {PipelineServiceClient} = aiplatform.v1;

ai-platform/snippets/create-training-pipeline-video-classification.js

+2-3
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,8 @@ async function main(
3535
// const project = 'YOUR_PROJECT_ID';
3636
// const location = 'YOUR_PROJECT_LOCATION';
3737
const aiplatform = require('@google-cloud/aiplatform');
38-
const {
39-
definition,
40-
} = aiplatform.protos.google.cloud.aiplatform.v1.schema.trainingjob;
38+
const {definition} =
39+
aiplatform.protos.google.cloud.aiplatform.v1.schema.trainingjob;
4140

4241
// Imports the Google Cloud Pipeline Service Client library
4342
const {PipelineServiceClient} = aiplatform.v1;

ai-platform/snippets/create-training-pipeline-video-object-tracking.js

+5-7
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,8 @@ async function main(
3535
// const project = 'YOUR_PROJECT_ID';
3636
// const location = 'YOUR_PROJECT_LOCATION';
3737
const aiplatform = require('@google-cloud/aiplatform');
38-
const {
39-
definition,
40-
} = aiplatform.protos.google.cloud.aiplatform.v1.schema.trainingjob;
38+
const {definition} =
39+
aiplatform.protos.google.cloud.aiplatform.v1.schema.trainingjob;
4140
const ModelType = definition.AutoMlVideoObjectTrackingInputs.ModelType;
4241

4342
// Imports the Google Cloud Pipeline Service Client library
@@ -55,11 +54,10 @@ async function main(
5554
// Configure the parent resource
5655
const parent = `projects/${project}/locations/${location}`;
5756

58-
const trainingTaskInputsObj = new definition.AutoMlVideoObjectTrackingInputs(
59-
{
57+
const trainingTaskInputsObj =
58+
new definition.AutoMlVideoObjectTrackingInputs({
6059
modelType: ModelType.CLOUD,
61-
}
62-
);
60+
});
6361
const trainingTaskInputs = trainingTaskInputsObj.toValue();
6462

6563
const modelToUpload = {displayName: modelDisplayName};

ai-platform/snippets/predict-image-classification.js

+4-8
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,8 @@ function main(filename, endpointId, project, location = 'us-central1') {
2828
// const project = 'YOUR_PROJECT_ID';
2929
// const location = 'YOUR_PROJECT_LOCATION';
3030
const aiplatform = require('@google-cloud/aiplatform');
31-
const {
32-
instance,
33-
params,
34-
prediction,
35-
} = aiplatform.protos.google.cloud.aiplatform.v1.schema.predict;
31+
const {instance, params, prediction} =
32+
aiplatform.protos.google.cloud.aiplatform.v1.schema.predict;
3633

3734
// Imports the Google Cloud Prediction Service Client library
3835
const {PredictionServiceClient} = aiplatform.v1;
@@ -77,9 +74,8 @@ function main(filename, endpointId, project, location = 'us-central1') {
7774
const predictions = response.predictions;
7875
console.log('\tPredictions :');
7976
for (const predictionValue of predictions) {
80-
const predictionResultObj = prediction.ClassificationPredictionResult.fromValue(
81-
predictionValue
82-
);
77+
const predictionResultObj =
78+
prediction.ClassificationPredictionResult.fromValue(predictionValue);
8379
for (const [i, label] of predictionResultObj.displayNames.entries()) {
8480
console.log(`\tDisplay name: ${label}`);
8581
console.log(`\tConfidences: ${predictionResultObj.confidences[i]}`);

ai-platform/snippets/predict-image-object-detection.js

+6-8
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,8 @@ async function main(filename, endpointId, project, location = 'us-central1') {
2828
// const project = 'YOUR_PROJECT_ID';
2929
// const location = 'YOUR_PROJECT_LOCATION';
3030
const aiplatform = require('@google-cloud/aiplatform');
31-
const {
32-
instance,
33-
params,
34-
prediction,
35-
} = aiplatform.protos.google.cloud.aiplatform.v1.schema.predict;
31+
const {instance, params, prediction} =
32+
aiplatform.protos.google.cloud.aiplatform.v1.schema.predict;
3633

3734
// Imports the Google Cloud Prediction Service Client library
3835
const {PredictionServiceClient} = aiplatform.v1;
@@ -77,9 +74,10 @@ async function main(filename, endpointId, project, location = 'us-central1') {
7774
const predictions = response.predictions;
7875
console.log('Predictions :');
7976
for (const predictionResultVal of predictions) {
80-
const predictionResultObj = prediction.ImageObjectDetectionPredictionResult.fromValue(
81-
predictionResultVal
82-
);
77+
const predictionResultObj =
78+
prediction.ImageObjectDetectionPredictionResult.fromValue(
79+
predictionResultVal
80+
);
8381
for (const [i, label] of predictionResultObj.displayNames.entries()) {
8482
console.log(`\tDisplay name: ${label}`);
8583
console.log(`\tConfidences: ${predictionResultObj.confidences[i]}`);

ai-platform/snippets/predict-tabular-classification.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,8 @@ async function main(endpointId, project, location = 'us-central1') {
2727
// const project = 'YOUR_PROJECT_ID';
2828
// const location = 'YOUR_PROJECT_LOCATION';
2929
const aiplatform = require('@google-cloud/aiplatform');
30-
const {
31-
prediction,
32-
} = aiplatform.protos.google.cloud.aiplatform.v1.schema.predict;
30+
const {prediction} =
31+
aiplatform.protos.google.cloud.aiplatform.v1.schema.predict;
3332

3433
// Imports the Google Cloud Prediction service client
3534
const {PredictionServiceClient} = aiplatform.v1;
@@ -72,9 +71,10 @@ async function main(endpointId, project, location = 'us-central1') {
7271
const predictions = response.predictions;
7372
console.log('Predictions :');
7473
for (const predictionResultVal of predictions) {
75-
const predictionResultObj = prediction.TabularClassificationPredictionResult.fromValue(
76-
predictionResultVal
77-
);
74+
const predictionResultObj =
75+
prediction.TabularClassificationPredictionResult.fromValue(
76+
predictionResultVal
77+
);
7878
for (const [i, class_] of predictionResultObj.classes.entries()) {
7979
console.log(`\tClass: ${class_}`);
8080
console.log(`\tScore: ${predictionResultObj.scores[i]}\n\n`);

ai-platform/snippets/predict-tabular-regression.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,8 @@ async function main(endpointId, project, location = 'us-central1') {
2727
// const project = 'YOUR_PROJECT_ID';
2828
// const location = 'YOUR_PROJECT_LOCATION';
2929
const aiplatform = require('@google-cloud/aiplatform');
30-
const {
31-
prediction,
32-
} = aiplatform.protos.google.cloud.aiplatform.v1.schema.predict;
30+
const {prediction} =
31+
aiplatform.protos.google.cloud.aiplatform.v1.schema.predict;
3332

3433
// Imports the Google Cloud Prediction service client
3534
const {PredictionServiceClient} = aiplatform.v1;
@@ -92,9 +91,10 @@ async function main(endpointId, project, location = 'us-central1') {
9291
const predictions = response.predictions;
9392
console.log('\tPredictions :');
9493
for (const predictionResultVal of predictions) {
95-
const predictionResultObj = prediction.TabularRegressionPredictionResult.fromValue(
96-
predictionResultVal
97-
);
94+
const predictionResultObj =
95+
prediction.TabularRegressionPredictionResult.fromValue(
96+
predictionResultVal
97+
);
9898
console.log(`\tUpper bound: ${predictionResultObj.upper_bound}`);
9999
console.log(`\tLower bound: ${predictionResultObj.lower_bound}`);
100100
console.log(`\tLower bound: ${predictionResultObj.value}`);

ai-platform/snippets/predict-text-classification.js

+9-11
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,8 @@ async function main(text, endpointId, project, location) {
2828
// const project = 'YOUR_PROJECT_ID';
2929
// const location = 'YOUR_PROJECT_LOCATION';
3030
const aiplatform = require('@google-cloud/aiplatform');
31-
const {
32-
instance,
33-
prediction,
34-
} = aiplatform.protos.google.cloud.aiplatform.v1.schema.predict;
31+
const {instance, prediction} =
32+
aiplatform.protos.google.cloud.aiplatform.v1.schema.predict;
3533

3634
// Imports the Google Cloud Model Service Client library
3735
const {PredictionServiceClient} = aiplatform.v1;
@@ -48,11 +46,10 @@ async function main(text, endpointId, project, location) {
4846
// Configure the resources
4947
const endpoint = `projects/${project}/locations/${location}/endpoints/${endpointId}`;
5048

51-
const predictionInstance = new instance.TextClassificationPredictionInstance(
52-
{
49+
const predictionInstance =
50+
new instance.TextClassificationPredictionInstance({
5351
content: text,
54-
}
55-
);
52+
});
5653
const instanceValue = predictionInstance.toValue();
5754

5855
const instances = [instanceValue];
@@ -68,9 +65,10 @@ async function main(text, endpointId, project, location) {
6865
console.log('Prediction results:');
6966

7067
for (const predictionResultValue of response.predictions) {
71-
const predictionResult = prediction.ClassificationPredictionResult.fromValue(
72-
predictionResultValue
73-
);
68+
const predictionResult =
69+
prediction.ClassificationPredictionResult.fromValue(
70+
predictionResultValue
71+
);
7472

7573
for (const [i, label] of predictionResult.displayNames.entries()) {
7674
console.log(`\tDisplay name: ${label}`);

ai-platform/snippets/predict-text-entity-extraction.js

+6-7
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,8 @@ async function main(text, endpointId, project, location = 'us-central1') {
2828
// const project = 'YOUR_PROJECT_ID';
2929
// const location = 'YOUR_PROJECT_LOCATION';
3030
const aiplatform = require('@google-cloud/aiplatform');
31-
const {
32-
instance,
33-
prediction,
34-
} = aiplatform.protos.google.cloud.aiplatform.v1.schema.predict;
31+
const {instance, prediction} =
32+
aiplatform.protos.google.cloud.aiplatform.v1.schema.predict;
3533

3634
// Imports the Google Cloud Model Service Client library
3735
const {PredictionServiceClient} = aiplatform.v1;
@@ -67,9 +65,10 @@ async function main(text, endpointId, project, location = 'us-central1') {
6765

6866
console.log('\nPredictions :');
6967
for (const predictionResultValue of response.predictions) {
70-
const predictionResult = prediction.TextExtractionPredictionResult.fromValue(
71-
predictionResultValue
72-
);
68+
const predictionResult =
69+
prediction.TextExtractionPredictionResult.fromValue(
70+
predictionResultValue
71+
);
7372

7473
for (const [i, label] of predictionResult.displayNames.entries()) {
7574
const textStartOffset = parseInt(

ai-platform/snippets/predict-text-sentiment-analysis.js

+6-7
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,8 @@ async function main(text, endpointId, project, location = 'us-central1') {
2828
// const project = 'YOUR_PROJECT_ID';
2929
// const location = 'YOUR_PROJECT_LOCATION';
3030
const aiplatform = require('@google-cloud/aiplatform');
31-
const {
32-
instance,
33-
prediction,
34-
} = aiplatform.protos.google.cloud.aiplatform.v1.schema.predict;
31+
const {instance, prediction} =
32+
aiplatform.protos.google.cloud.aiplatform.v1.schema.predict;
3533

3634
// Imports the Google Cloud Model Service Client library
3735
const {PredictionServiceClient} = aiplatform.v1;
@@ -67,9 +65,10 @@ async function main(text, endpointId, project, location = 'us-central1') {
6765

6866
console.log('\nPredictions :');
6967
for (const predictionResultValue of response.predictions) {
70-
const predictionResult = prediction.TextSentimentPredictionResult.fromValue(
71-
predictionResultValue
72-
);
68+
const predictionResult =
69+
prediction.TextSentimentPredictionResult.fromValue(
70+
predictionResultValue
71+
);
7372
console.log(`\tSentiment measure: ${predictionResult.sentiment}`);
7473
}
7574
}

0 commit comments

Comments
 (0)