Skip to content

Commit acd09f9

Browse files
committed
fix other JS quickstarts
1 parent de6a856 commit acd09f9

File tree

4 files changed

+40
-23
lines changed

4 files changed

+40
-23
lines changed

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

Lines changed: 13 additions & 7 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
---
@@ -27,12 +27,12 @@ You must have a subscription key for Computer Vision. You can get a free trial k
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: 13 additions & 7 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
---
@@ -48,12 +48,12 @@ You must have a subscription key for Computer Vision. You can get a free trial k
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: 13 additions & 7 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: 03/26/2019
12+
ms.date: 03/26/2020
1313
ms.author: pafarley
1414
ms.custom: seodec18
1515
---
@@ -31,12 +31,12 @@ You must have a subscription key for Computer Vision. You can get a free trial k
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: 1 addition & 2 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
---
@@ -29,7 +29,6 @@ To create and run the sample, do the following steps:
2929

3030
1. Create a file called _get-thumbnail.html_, open it in a text editor, and copy the following code into it.
3131
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.
32-
1. Save the code as a file with an `.html` extension. For example, `get-thumbnail.html`.
3332
1. Open a browser window.
3433
1. In the browser, drag and drop the file into the browser window.
3534
1. When the webpage is displayed in the browser, paste your subscription key and endpoint URL into the appropriate input boxes.

0 commit comments

Comments
 (0)