Skip to content

Commit 1c8606d

Browse files
authored
Merge pull request #109278 from PatrickFarley/comvis-updates
[cog serv] fix JS qs
2 parents b63c7b6 + 58188e7 commit 1c8606d

File tree

4 files changed

+57
-33
lines changed

4 files changed

+57
-33
lines changed

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

Lines changed: 14 additions & 8 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: 12/05/2019
12+
ms.date: 03/26/2020
1313
ms.author: pafarley
1414
ms.custom: seodec18
1515
---
@@ -21,18 +21,18 @@ If you don't have an Azure subscription, create a [free account](https://azure.m
2121

2222
## Prerequisites
2323

24-
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. Then, [create environment variables](https://docs.microsoft.com/azure/cognitive-services/cognitive-services-apis-create-account#configure-an-environment-variable-for-authentication) for the key and service endpoint string, named `COMPUTER_VISION_SUBSCRIPTION_KEY` and `COMPUTER_VISION_ENDPOINT`, respectively.
24+
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. Save your subscription key and endpoint URL to a temporary location.
2525

2626
## Create and run the sample
2727

2828
To create and run the sample, do the following steps:
2929

30-
1. Copy the following code into a text editor.
30+
1. Create a file called _analyze-image.html_, open it in a text editor, and copy the following code into it.
3131
1. Optionally, replace the value of the `value` attribute for the `inputImage` control with the URL of a different image that you want to analyze.
32-
1. Save the code as a file with an `.html` extension. For example, `analyze-image.html`.
3332
1. Open a browser window.
3433
1. In the browser, drag and drop the file into the browser window.
35-
1. When the webpage is displayed in the browser, choose the **Analyze Image** button.
34+
1. When the webpage is displayed in the browser, paste your subscription key and endpoint URL into the appropriate input boxes.
35+
1. Select the **Analyze Image** button.
3636

3737
```html
3838
<!DOCTYPE html>
@@ -49,9 +49,8 @@ To create and run the sample, do the following steps:
4949
// *** Update or verify the following values. ***
5050
// **********************************************
5151
52-
let subscriptionKey = process.env['COMPUTER_VISION_SUBSCRIPTION_KEY'];
53-
let endpoint = process.env['COMPUTER_VISION_ENDPOINT']
54-
if (!subscriptionKey) { throw new Error('Set your environment variables for your subscription key and endpoint.'); }
52+
var subscriptionKey = document.getElementById("subscriptionKey").value;
53+
var endpoint = document.getElementById("endpointUrl").value;
5554
5655
var uriBase = endpoint + "vision/v2.1/analyze";
5756
@@ -102,6 +101,13 @@ To create and run the sample, do the following steps:
102101
<h1>Analyze image:</h1>
103102
Enter the URL to an image, then click the <strong>Analyze image</strong> button.
104103
<br><br>
104+
Subscription key:
105+
<input type="text" name="subscriptionKey" id="subscriptionKey"
106+
value="" />
107+
Endpoint URL:
108+
<input type="text" name="endpointUrl" id="endpointUrl"
109+
value="" />
110+
<br><br>
105111
Image to analyze:
106112
<input type="text" name="inputImage" id="inputImage"
107113
value="https://upload.wikimedia.org/wikipedia/commons/3/3c/Shaki_waterfall.jpg" />

articles/cognitive-services/Computer-vision/QuickStarts/javascript-hand-text.md

Lines changed: 14 additions & 8 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: 12/05/2019
12+
ms.date: 03/26/2020
1313
ms.author: pafarley
1414
ms.custom: seodec18
1515
---
@@ -40,20 +40,20 @@ Compared to Computer Vision 2.0 and 2.1, the Computer Vision 3.0 Public Preview
4040

4141
If you don't have an Azure subscription, create a [free account](https://azure.microsoft.com/free/ai/?ref=microsoft.com&utm_source=microsoft.com&utm_medium=docs&utm_campaign=cognitive-services) before you begin.
4242

43-
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. Then, [create environment variables](https://docs.microsoft.com/azure/cognitive-services/cognitive-services-apis-create-account#configure-an-environment-variable-for-authentication) for the key and service endpoint string, named `COMPUTER_VISION_SUBSCRIPTION_KEY` and `COMPUTER_VISION_ENDPOINT`, respectively.
43+
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. Save your subscription key and endpoint URL to a temporary location.
4444

4545
## Create and run the sample
4646

4747
#### [Version 2](#tab/version-2)
4848

4949
To create and run the sample, do the following steps:
5050

51-
1. Copy the following code into a text editor.
51+
1. Create a file called _get-text.html_, open it in a text editor, and copy the following code into it.
5252
1. Optionally, replace the value of the `value` attribute for the `inputImage` control with the URL of a different image from which you want to extract text.
53-
1. Save the code as a file with an `.html` extension. For example, `get-text.html`.
5453
1. Open a browser window.
5554
1. In the browser, drag and drop the file into the browser window.
56-
1. When the webpage is displayed in the browser, choose the **Read image** button.
55+
1. When the webpage is displayed in the browser, paste your subscription key and endpoint URL into the appropriate input boxes.
56+
1. Select the **Read image** button.
5757

5858
```html
5959
<!DOCTYPE html>
@@ -70,9 +70,8 @@ To create and run the sample, do the following steps:
7070
// *** Update or verify the following values. ***
7171
// **********************************************
7272
73-
let subscriptionKey = process.env['COMPUTER_VISION_SUBSCRIPTION_KEY'];
74-
let endpoint = process.env['COMPUTER_VISION_ENDPOINT']
75-
if (!subscriptionKey) { throw new Error('Set your environment variables for your subscription key and endpoint.'); }
73+
var subscriptionKey = document.getElementById("subscriptionKey").value;
74+
var endpoint = document.getElementById("endpointUrl").value;
7675
7776
var uriBase = endpoint + "vision/v2.1/read/core/asyncBatchAnalyze";
7877
@@ -166,6 +165,13 @@ To create and run the sample, do the following steps:
166165
Enter the URL to an image of text, then click
167166
the <strong>Read image</strong> button.
168167
<br><br>
168+
Subscription key:
169+
<input type="text" name="subscriptionKey" id="subscriptionKey"
170+
value="" />
171+
Endpoint URL:
172+
<input type="text" name="endpointUrl" id="endpointUrl"
173+
value="" />
174+
<br><br>
169175
Image to read:
170176
<input type="text" name="inputImage" id="inputImage"
171177
value="https://upload.wikimedia.org/wikipedia/commons/thumb/d/dd/Cursive_Writing_on_Notebook_paper.jpg/800px-Cursive_Writing_on_Notebook_paper.jpg" />

articles/cognitive-services/Computer-vision/QuickStarts/javascript-print-text.md

Lines changed: 14 additions & 8 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: 12/05/2019
12+
ms.date: 03/26/2020
1313
ms.author: pafarley
1414
ms.custom: seodec18
1515
---
@@ -25,18 +25,18 @@ If you don't have an Azure subscription, create a [free account](https://azure.m
2525

2626
## Prerequisites
2727

28-
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. Then, [create environment variables](https://docs.microsoft.com/azure/cognitive-services/cognitive-services-apis-create-account#configure-an-environment-variable-for-authentication) for the key and service endpoint string, named `COMPUTER_VISION_SUBSCRIPTION_KEY` and `COMPUTER_VISION_ENDPOINT`, respectively.
28+
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. Save your subscription key and endpoint URL to a temporary location.
2929

3030
## Create and run the sample
3131

3232
To create and run the sample, do the following steps:
3333

34-
1. Copy the following code into a text editor.
34+
1. Create a file called _get-printed-text.html_, open it in a text editor, and copy the following code into it.
3535
1. Optionally, replace the value of the `value` attribute for the `inputImage` control with the URL of a different image that you want to analyze.
36-
1. Save the code as a file with an `.html` extension. For example, `get-printed-text.html`.
3736
1. Open a browser window.
3837
1. In the browser, drag and drop the file into the browser window.
39-
1. When the webpage is displayed in the browser, choose the **Read image** button.
38+
1. When the webpage is displayed in the browser, paste your subscription key and endpoint URL into the appropriate input boxes.
39+
1. Select the **Read image** button.
4040

4141
```html
4242
<!DOCTYPE html>
@@ -53,9 +53,8 @@ To create and run the sample, do the following steps:
5353
// *** Update or verify the following values. ***
5454
// **********************************************
5555
56-
let subscriptionKey = process.env['COMPUTER_VISION_SUBSCRIPTION_KEY'];
57-
let endpoint = process.env['COMPUTER_VISION_ENDPOINT']
58-
if (!subscriptionKey) { throw new Error('Set your environment variables for your subscription key and endpoint.'); }
56+
var subscriptionKey = document.getElementById("subscriptionKey").value;
57+
var endpoint = document.getElementById("endpointUrl").value;
5958
6059
var uriBase = endpoint + "vision/v2.1/ocr";
6160
@@ -107,6 +106,13 @@ To create and run the sample, do the following steps:
107106
Enter the URL to an image of printed text, then
108107
click the <strong>Read image</strong> button.
109108
<br><br>
109+
Subscription key:
110+
<input type="text" name="subscriptionKey" id="subscriptionKey"
111+
value="" />
112+
Endpoint URL:
113+
<input type="text" name="endpointUrl" id="endpointUrl"
114+
value="" />
115+
<br><br>
110116
Image to read:
111117
<input type="text" name="inputImage" id="inputImage"
112118
value="https://upload.wikimedia.org/wikipedia/commons/thumb/a/af/Atomist_quote_from_Democritus.png/338px-Atomist_quote_from_Democritus.png" />

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

Lines changed: 15 additions & 9 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: 12/05/2019
12+
ms.date: 03/26/2020
1313
ms.author: pafarley
1414
ms.custom: seodec18
1515
---
@@ -21,18 +21,18 @@ If you don't have an Azure subscription, create a [free account](https://azure.m
2121

2222
## Prerequisites
2323

24-
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. Then, [create environment variables](https://docs.microsoft.com/azure/cognitive-services/cognitive-services-apis-create-account#configure-an-environment-variable-for-authentication) for the key and service endpoint string, named `COMPUTER_VISION_SUBSCRIPTION_KEY` and `COMPUTER_VISION_ENDPOINT`, respectively.
24+
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. Save your subscription key and endpoint URL to a temporary location.
2525

2626
## Create and run the sample
2727

2828
To create and run the sample, do the following steps:
2929

30-
1. Copy the following code into a text editor.
31-
1. Optionally, replace the value of the `value` attribute for the `inputImage` control with the URL of a different image that you want to analyze.
32-
1. Save the code as a file with an `.html` extension. For example, `get-thumbnail.html`.
30+
1. Create a file called _get-thumbnail.html_, open it in a text editor, and copy the following code into it.
31+
1. Optionally, replace the value of the `value` attribute of the `inputImage` control with the URL of a different image that you want to analyze.
3332
1. Open a browser window.
3433
1. In the browser, drag and drop the file into the browser window.
35-
1. When the webpage is displayed in the browser, choose the **Generate thumbnail** button.
34+
1. When the webpage is displayed in the browser, paste your subscription key and endpoint URL into the appropriate input boxes.
35+
1. Finally, select the **Generate thumbnail** button.
3636

3737
```html
3838
<!DOCTYPE html>
@@ -48,9 +48,8 @@ To create and run the sample, do the following steps:
4848
// *** Update or verify the following values. ***
4949
// **********************************************
5050
51-
let subscriptionKey = process.env['COMPUTER_VISION_SUBSCRIPTION_KEY'];
52-
let endpoint = process.env['COMPUTER_VISION_ENDPOINT']
53-
if (!subscriptionKey) { throw new Error('Set your environment variables for your subscription key and endpoint.'); }
51+
var subscriptionKey = document.getElementById("subscriptionKey").value;
52+
var endpoint = document.getElementById("endpointUrl").value;
5453
5554
var uriBase = endpoint + "vision/v2.1/generateThumbnail";
5655
@@ -118,6 +117,13 @@ To create and run the sample, do the following steps:
118117
Enter the URL to an image to use in creating a thumbnail image,
119118
then click the <strong>Generate thumbnail</strong> button.
120119
<br><br>
120+
Subscription key:
121+
<input type="text" name="subscriptionKey" id="subscriptionKey"
122+
value="" />
123+
Endpoint URL:
124+
<input type="text" name="endpointUrl" id="endpointUrl"
125+
value="" />
126+
<br><br>
121127
Image for thumbnail:
122128
<input type="text" name="inputImage" id="inputImage"
123129
value="https://upload.wikimedia.org/wikipedia/commons/thumb/5/56/Shorkie_Poo_Puppy.jpg/1280px-Shorkie_Poo_Puppy.jpg" />

0 commit comments

Comments
 (0)