1515
1616'use strict' ;
1717
18- // [START vision_face_detection_client ]
18+ // [START vision_face_detection_tutorial_client ]
1919// By default, the client will authenticate using the service account file
2020// specified by the GOOGLE_APPLICATION_CREDENTIALS environment variable and use
2121// the project specified by the GCLOUD_PROJECT environment variable. See
@@ -26,12 +26,12 @@ var vision = require('@google-cloud/vision');
2626var client = new vision . ImageAnnotatorClient ( ) ;
2727
2828var fs = require ( 'fs' ) ;
29- // [END vision_face_detection_client ]
29+ // [END vision_face_detection_tutorial_client ]
3030
3131/**
3232 * Uses the Vision API to detect faces in the given file.
3333 */
34- // [START vision_face_detection_send_request ]
34+ // [START vision_face_detection_tutorial_send_request ]
3535function detectFaces ( inputFile , callback ) {
3636 // Make a call to the Vision API to detect the faces
3737 const request = { image : { source : { filename : inputFile } } } ;
@@ -48,12 +48,12 @@ function detectFaces(inputFile, callback) {
4848 callback ( err ) ;
4949 } ) ;
5050}
51- // [END vision_face_detection_send_request ]
51+ // [END vision_face_detection_tutorial_send_request ]
5252
5353/**
5454 * Draws a polygon around the faces, then saves to outputFile.
5555 */
56- // [START vision_face_detection_process_response ]
56+ // [START vision_face_detection_tutorial_process_response ]
5757function highlightFaces ( inputFile , faces , outputFile , Canvas , callback ) {
5858 fs . readFile ( inputFile , ( err , image ) => {
5959 if ( err ) {
@@ -99,10 +99,10 @@ function highlightFaces(inputFile, faces, outputFile, Canvas, callback) {
9999 pngStream . on ( 'end' , callback ) ;
100100 } ) ;
101101}
102- // [END vision_face_detection_process_response ]
102+ // [END vision_face_detection_tutorial_process_response ]
103103
104104// Run the example
105- // [START vision_face_detection_run_application ]
105+ // [START vision_face_detection_tutorial_run_application ]
106106function main ( inputFile , outputFile , Canvas , callback ) {
107107 outputFile = outputFile || 'out.png' ;
108108 detectFaces ( inputFile , ( err , faces ) => {
@@ -120,7 +120,7 @@ function main(inputFile, outputFile, Canvas, callback) {
120120 } ) ;
121121 } ) ;
122122}
123- // [END vision_face_detection_run_application ]
123+ // [END vision_face_detection_tutorial_run_application ]
124124
125125exports . main = main ;
126126
0 commit comments