@@ -16,7 +16,8 @@ public static void main(String[] args)
1616 RunQuickstarts ();
1717 }
1818
19- /* This Quickstart for the Azure Cognitive Services Computer Vision API shows how to analyze
19+ /**
20+ * This Quickstart for the Azure Cognitive Services Computer Vision API shows how to analyze
2021 * an image both locally and from a URL.
2122 * Analyzing an image includes:
2223 * - Displaying image captions and confidence values
@@ -28,40 +29,17 @@ public static void main(String[] args)
2829 * - Displaying any celebrities detected in the image and their bounding boxes
2930 * - Displaying any landmarks detected in the image and their bounding boxes
3031 * - Displaying what type of clip art or line drawing the image is
31- *
3232 */
3333
34-
3534 public static void RunQuickstarts ()
36- {
37- /* Configure the local environment:
38- *
39- * Set the AZURE_COMPUTERVISION_API_KEY and AZURE_REGION environment variables on your
40- * local machine using the appropriate method for your preferred command shell.
41- *
42- * For AZURE_REGION, use the same region you used to get your subscription keys.
43- ***Can we link (or just put the URL here) to the docs for finding your region?
44- *
45- * Note that environment variables cannot contain quotation marks, so the quotation marks
46- * are included in the code below to stringify them.
47- *
48- * Note that after setting these environment variables in your preferred command shell,
49- * you will need to close and then re-open your command shell.
50- */
51-
52- String azureComputerVisionApiKey = System .getenv ("AZURE_COMPUTERVISION_API_KEY" );
53- String azureRegion = System .getenv ("AZURE_REGION" );
54- // END - Configure the local environment.
55-
56-
57- /* Create an authenticated Computer Vision client:
58- *
59- * Concatenate the Azure region with the Azure base URL to create the endpoint URL, and
60- * then create an authenticated client with the API key and the endpoint URL.
61- */
62-
63- String endpointUrl = ("https://" ).concat (azureRegion ).concat (".api.cognitive.microsoft.com" );
64- ComputerVisionClient compVisClient = ComputerVisionManager .authenticate (azureComputerVisionApiKey ).withEndpoint (endpointUrl );
35+ {
36+ // Add your Computer Vision subscription key and endpoint to your environment variables.
37+ // After setting, close and then re-open your command shell or project.
38+ String subscriptionKey = System .getenv ("COMPUTER_VISION_SUBSCRIPTION_KEY" );
39+ String endpoint = System .getenv ("COMPUTER_VISION_ENDPOINT" );
40+
41+ // Create an authenticated Computer Vision client
42+ ComputerVisionClient compVisClient = ComputerVisionManager .authenticate (subscriptionKey ).withEndpoint (endpoint );
6543 // END - Create an authenticated Computer Vision client.
6644
6745
0 commit comments