Skip to content

Commit

Permalink
Android code snippets: Update examples to show how to use default opt…
Browse files Browse the repository at this point in the history
…ions
  • Loading branch information
calren committed Jun 5, 2020
1 parent 21eea5b commit 2c3370b
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ private void detectFaces(InputImage image) {

// [START get_detector]
FaceDetector detector = FaceDetection.getClient(options);
// Or, to use the default option:
// FaceDetector detector = FaceDetection.getClient();
// [END get_detector]

// [START run_detector]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,9 @@ public void onFailure(@NonNull Exception e) {
}

private void configureAndRunImageLabeler(InputImage image) {
ImageLabelerOptions options =
new ImageLabelerOptions.Builder()
.build();

// [START on_device_image_labeler]
ImageLabeler labeler = ImageLabeling.getClient(options);
// To use default options:
ImageLabeler labeler = ImageLabeling.getClient(ImageLabelerOptions.DEFAULT_OPTIONS);

// Or, to set the minimum confidence required:
// ImageLabelerOptions options =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ class FaceDetectionActivity : AppCompatActivity() {

// [START get_detector]
val detector = FaceDetection.getClient(options)
// Or, to use the default option:
// val detector = FaceDetection.getClient();
// [END get_detector]

// [START run_detector]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,9 @@ class ImageLabelingActivity : AppCompatActivity() {
}

private fun configureAndRunImageLabeler(image: InputImage) {
val options = ImageLabelerOptions.Builder()
.build()

// [START on_device_image_labeler]
val labeler = ImageLabeling.getClient(options)
// To use default options:
val labeler = ImageLabeling.getClient(ImageLabelerOptions.DEFAULT_OPTIONS)

// Or, to set the minimum confidence required:
// val options = ImageLabelerOptions.Builder()
Expand Down

0 comments on commit 2c3370b

Please sign in to comment.