Skip to content

Commit 546935e

Browse files
authored
Merge pull request #115064 from v-jaswel/patch-13
[DO NOT MERGE UNTIL BUILD] Update curl-analyze.md, go-analyze.md, java-analyze.md, javascript-analyze.md, node-analyze.md, python-analyze.md
2 parents 7797e9b + 19f05a1 commit 546935e

File tree

6 files changed

+18
-24
lines changed

6 files changed

+18
-24
lines changed

articles/cognitive-services/Computer-vision/QuickStarts/curl-analyze.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ If you don't have an Azure subscription, create a [free account](https://azure.m
2323
## Prerequisites
2424

2525
- You must have [cURL](https://curl.haxx.se/windows).
26-
- You must have a subscription key for Computer Vision. You can get a free trial key from [Try Cognitive Services](https://azure.microsoft.com/try/cognitive-services/?api=computer-vision). Or, follow the instructions in [Create a Cognitive Services account](https://docs.microsoft.com/azure/cognitive-services/cognitive-services-apis-create-account) to subscribe to Computer Vision and get your key.
26+
- You must have a subscription key for Computer Vision. You can get a free trial key from [Try Cognitive Services](https://azure.microsoft.com/try/cognitive-services/?api=computer-vision). Or, follow the instructions in [Create a Cognitive Services account](https://docs.microsoft.com/azure/cognitive-services/cognitive-services-apis-create-account) to subscribe to Computer Vision and get your key.
2727

2828
## Create and run the sample command
2929

@@ -40,7 +40,7 @@ To create and run the sample, do the following steps:
4040
1. Paste the command from the text editor into the command prompt window, and then run the command.
4141

4242
```bash
43-
curl -H "Ocp-Apim-Subscription-Key: <subscriptionKey>" -H "Content-Type: application/json" "https://westcentralus.api.cognitive.microsoft.com/vision/v2.1/analyze?visualFeatures=Categories,Description&details=Landmarks&language=en" -d "{\"url\":\"http://upload.wikimedia.org/wikipedia/commons/3/3c/Shaki_waterfall.jpg\"}"
43+
curl -H "Ocp-Apim-Subscription-Key: <subscriptionKey>" -H "Content-Type: application/json" "https://westcentralus.api.cognitive.microsoft.com/vision/v3.0/analyze?visualFeatures=Categories,Description&details=Landmarks&language=en" -d "{\"url\":\"http://upload.wikimedia.org/wikipedia/commons/3/3c/Shaki_waterfall.jpg\"}"
4444
```
4545

4646
## Examine the response

articles/cognitive-services/Computer-vision/QuickStarts/go-analyze.md

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -43,28 +43,22 @@ import (
4343
"fmt"
4444
"io/ioutil"
4545
"net/http"
46+
"os"
4647
"strings"
4748
"time"
4849
)
4950

5051
func main() {
5152
// Add your Computer Vision subscription key and endpoint to your environment variables.
5253
subscriptionKey := os.Getenv("COMPUTER_VISION_SUBSCRIPTION_KEY")
53-
if (subscriptionKey == "") {
54-
log.Fatal("\n\nSet the COMPUTER_VISION_SUBSCRIPTION_KEY environment variable.\n" +
55-
"**Restart your shell or IDE for changes to take effect.**\n")
56-
5754
endpoint := os.Getenv("COMPUTER_VISION_ENDPOINT")
58-
if ("" == endpoint) {
59-
log.Fatal("\n\nSet the COMPUTER_VISION_ENDPOINT environment variable.\n" +
60-
"**Restart your shell or IDE for changes to take effect.**")
61-
}
62-
const uriBase = endpoint + "vision/v2.1/analyze"
55+
56+
uriBase := endpoint + "vision/v3.0/analyze"
6357
const imageUrl =
6458
"https://upload.wikimedia.org/wikipedia/commons/3/3c/Shaki_waterfall.jpg"
6559

6660
const params = "?visualFeatures=Description&details=Landmarks&language=en"
67-
const uri = uriBase + params
61+
uri := uriBase + params
6862
const imageUrlEnc = "{\"url\":\"" + imageUrl + "\"}"
6963

7064
reader := strings.NewReader(imageUrlEnc)

articles/cognitive-services/Computer-vision/QuickStarts/java-analyze.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ ms.date: 04/14/2020
1313
ms.author: pafarley
1414
ms.custom: seodec18, seo-java-august2019, seo-java-september2019
1515
---
16+
1617
# Quickstart: Analyze a remote image using the Computer Vision REST API and Java
1718

1819
In this quickstart, you'll analyze a remotely stored image to extract visual features by using Java and the Computer Vision REST API. With the [Analyze Image](https://westcentralus.dev.cognitive.microsoft.com/docs/services/5adf991815e1060e6355ad44/operations/56f91f2e778daf14a499e1fa) method, you can extract visual features based on image content.
@@ -48,25 +49,24 @@ To create and run the sample, do the following steps:
4849
import org.json.JSONObject;
4950
```
5051

51-
1. Replace the `Main` public class with the following code.
52+
1. Replace the `AnalyzeImage` public class with the following code.
5253
1. Optionally, replace the value of `imageToAnalyze` with the URL of a different image that you want to analyze.
5354

5455
```java
55-
public class Main {
56+
public class AnalyzeImage {
5657
// **********************************************
5758
// *** Update or verify the following values. ***
5859
// **********************************************
5960

6061
// Add your Computer Vision subscription key and endpoint to your environment variables.
6162
// After setting, close and then re-open your command shell or project for the changes to take effect.
62-
String subscriptionKey = System.getenv("COMPUTER_VISION_SUBSCRIPTION_KEY");
63-
String endpoint = ("COMPUTER_VISION_ENDPOINT");
63+
private static String subscriptionKey = System.getenv("COMPUTER_VISION_SUBSCRIPTION_KEY");
64+
private static String endpoint = System.getenv("COMPUTER_VISION_ENDPOINT");
6465

65-
private static final String uriBase = endpoint +
66-
"vision/v2.1/analyze";
66+
private static final String uriBase = endpoint + "vision/v3.0/analyze";
6767
private static final String imageToAnalyze =
6868
"https://upload.wikimedia.org/wikipedia/commons/" +
69-
"1/12/Broadway_and_Times_Square_by_night.jpg";
69+
"1/12/Broadway_and_Times_Square_by_night.jpg";
7070

7171
public static void main(String[] args) {
7272
CloseableHttpClient httpClient = HttpClientBuilder.create().build();

articles/cognitive-services/Computer-vision/QuickStarts/javascript-analyze.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ To create and run the sample, do the following steps:
5252
var subscriptionKey = document.getElementById("subscriptionKey").value;
5353
var endpoint = document.getElementById("endpointUrl").value;
5454
55-
var uriBase = endpoint + "vision/v2.1/analyze";
55+
var uriBase = endpoint + "vision/v3.0/analyze";
5656
5757
// Request parameters.
5858
var params = {

articles/cognitive-services/Computer-vision/QuickStarts/node-analyze.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ let subscriptionKey = process.env['COMPUTER_VISION_SUBSCRIPTION_KEY'];
5555
let endpoint = process.env['COMPUTER_VISION_ENDPOINT']
5656
if (!subscriptionKey) { throw new Error('Set your environment variables for your subscription key and endpoint.'); }
5757

58-
var uriBase = endpoint + 'vision/v2.1/analyze';
58+
var uriBase = endpoint + 'vision/v3.0/analyze';
5959

6060
const imageUrl =
6161
'https://upload.wikimedia.org/wikipedia/commons/3/3c/Shaki_waterfall.jpg';

articles/cognitive-services/Computer-vision/QuickStarts/python-analyze.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ manager: nitinme
99
ms.service: cognitive-services
1010
ms.subservice: computer-vision
1111
ms.topic: quickstart
12-
ms.date: 05/01/2020
12+
ms.date: 04/14/2020
1313
ms.author: pafarley
1414
ms.custom: seodec18
1515
---
@@ -61,7 +61,7 @@ else:
6161
if 'COMPUTER_VISION_ENDPOINT' in os.environ:
6262
endpoint = os.environ['COMPUTER_VISION_ENDPOINT']
6363

64-
analyze_url = endpoint + "vision/v2.1/analyze"
64+
analyze_url = endpoint + "vision/v3.0/analyze"
6565

6666
# Set image_url to the URL of an image that you want to analyze.
6767
image_url = "https://upload.wikimedia.org/wikipedia/commons/thumb/1/12/" + \
@@ -171,4 +171,4 @@ Next, explore a Python application that uses Computer Vision to perform optical
171171
> [!div class="nextstepaction"]
172172
> [Computer Vision API Python Tutorial](../Tutorials/PythonTutorial.md)
173173
174-
* To rapidly experiment with the Computer Vision API, try the [Open API testing console](https://westcentralus.dev.cognitive.microsoft.com/docs/services/5adf991815e1060e6355ad44/operations/56f91f2e778daf14a499e1fa/console).
174+
* To rapidly experiment with the Computer Vision API, try the [Open API testing console](https://westcentralus.dev.cognitive.microsoft.com/docs/services/5adf991815e1060e6355ad44/operations/56f91f2e778daf14a499e1fa/console).

0 commit comments

Comments
 (0)