Skip to content

Commit cb74e9f

Browse files
kurtisvgchingor13
authored andcommitted
samples: Update vision folder. (#999)
* Update vision/cloud-client * Updated vision/face-detection. * Updated vision/label * Updated vision/landmark-detection * Updated vision/text * Fix checkstyle issues with landmarkdetection.
1 parent e087b28 commit cb74e9f

File tree

3 files changed

+49
-48
lines changed

3 files changed

+49
-48
lines changed

vision/snippets/src/main/java/com/example/vision/Detect.java

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
11
/*
2-
Copyright 2017, Google, Inc.
2+
* Copyright 2017 Google Inc.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
316

4-
Licensed under the Apache License, Version 2.0 (the "License");
5-
you may not use this file except in compliance with the License.
6-
You may obtain a copy of the License at
7-
8-
http://www.apache.org/licenses/LICENSE-2.0
9-
10-
Unless required by applicable law or agreed to in writing, software
11-
distributed under the License is distributed on an "AS IS" BASIS,
12-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13-
See the License for the specific language governing permissions and
14-
limitations under the License.
15-
*/
1617

1718
package com.example.vision;
1819

@@ -43,7 +44,6 @@
4344
import com.google.cloud.vision.v1.WebDetection.WebPage;
4445
import com.google.cloud.vision.v1.Word;
4546
import com.google.protobuf.ByteString;
46-
4747
import java.io.FileInputStream;
4848
import java.io.IOException;
4949
import java.io.PrintStream;
@@ -805,7 +805,8 @@ public static void detectWebDetections(String filePath, PrintStream out) throws
805805
}
806806

807807
/**
808-
* Detects whether the specified remote image on Google Cloud Storage has features you would want to moderate.
808+
* Detects whether the specified remote image on Google Cloud Storage has features you would want
809+
* to moderate.
809810
*
810811
* @param gcsPath The path to the remote file on Google Cloud Storage to detect safe-search on.
811812
* @param out A {@link PrintStream} to write the results to.

vision/snippets/src/main/java/com/example/vision/QuickstartSample.java

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,25 @@
11
/*
2-
Copyright 2017, Google, Inc.
2+
* Copyright 2017 Google Inc.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
316

4-
Licensed under the Apache License, Version 2.0 (the "License");
5-
you may not use this file except in compliance with the License.
6-
You may obtain a copy of the License at
7-
8-
http://www.apache.org/licenses/LICENSE-2.0
9-
10-
Unless required by applicable law or agreed to in writing, software
11-
distributed under the License is distributed on an "AS IS" BASIS,
12-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13-
See the License for the specific language governing permissions and
14-
limitations under the License.
15-
*/
1617

1718
package com.example.vision;
1819

1920
// [START vision_quickstart]
2021
// Imports the Google Cloud client library
22+
2123
import com.google.cloud.vision.v1.AnnotateImageRequest;
2224
import com.google.cloud.vision.v1.AnnotateImageResponse;
2325
import com.google.cloud.vision.v1.BatchAnnotateImagesResponse;
@@ -27,7 +29,6 @@
2729
import com.google.cloud.vision.v1.Image;
2830
import com.google.cloud.vision.v1.ImageAnnotatorClient;
2931
import com.google.protobuf.ByteString;
30-
3132
import java.nio.file.Files;
3233
import java.nio.file.Path;
3334
import java.nio.file.Paths;
@@ -68,7 +69,7 @@ public static void main(String... args) throws Exception {
6869
}
6970

7071
for (EntityAnnotation annotation : res.getLabelAnnotationsList()) {
71-
annotation.getAllFields().forEach((k, v)->
72+
annotation.getAllFields().forEach((k, v) ->
7273
System.out.printf("%s : %s\n", k, v.toString()));
7374
}
7475
}

vision/snippets/src/test/java/com/example/vision/DetectIT.java

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,32 @@
11
/*
2-
Copyright 2017, Google, Inc.
3-
4-
Licensed under the Apache License, Version 2.0 (the "License");
5-
you may not use this file except in compliance with the License.
6-
You may obtain a copy of the License at
7-
8-
http://www.apache.org/licenses/LICENSE-2.0
9-
10-
Unless required by applicable law or agreed to in writing, software
11-
distributed under the License is distributed on an "AS IS" BASIS,
12-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13-
See the License for the specific language governing permissions and
14-
limitations under the License.
15-
*/
2+
* Copyright 2017 Google Inc.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
1616

1717
package com.example.vision;
1818

1919
import static com.google.common.truth.Truth.assertThat;
2020

21+
import java.io.ByteArrayOutputStream;
22+
import java.io.IOException;
23+
import java.io.PrintStream;
2124
import org.junit.After;
2225
import org.junit.Before;
2326
import org.junit.Test;
2427
import org.junit.runner.RunWith;
2528
import org.junit.runners.JUnit4;
2629

27-
import java.io.ByteArrayOutputStream;
28-
import java.io.IOException;
29-
import java.io.PrintStream;
30-
3130
/** Tests for vision "Detect" sample. */
3231
@RunWith(JUnit4.class)
3332
@SuppressWarnings("checkstyle:abbreviationaswordinname")

0 commit comments

Comments
 (0)