Skip to content

Commit e674c7c

Browse files
authored
Merge pull request #47 from wiazur/patch-7
Updated endpoint
2 parents 66599de + 7fee184 commit e674c7c

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

dotnet/ComputerVision/OCR/Program.cs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,10 @@ namespace Microsoft.Azure.CognitiveServices.Samples.ComputerVision.OCR
1010

1111
class Program
1212
{
13-
public const string subscriptionKey = "<your training key here>"; //Insert your Cognitive Services subscription key here
14-
public const string endpoint = "https://westus.api.cognitive.microsoft.com"; // You must use the same Azure region that you generated your subscription keys for. Free trial subscription keys are generated in the westus region.
15-
13+
// Add your Azure Computer Vision subscription key and endpoint to your environment variables
14+
public const string subscriptionKey = Environment.GetEnvironmentVariable("COMPUTER_VISION_SUBSCRIPTION_KEY");
15+
public const string endpoint = Environment.GetEnvironmentVariable("COMPUTER_VISION_ENDPOINT");
16+
1617
static void Main(string[] args)
1718
{
1819
OCRSample.RunAsync(endpoint, subscriptionKey).Wait(5000);
@@ -27,10 +28,10 @@ public class OCRSample
2728
public static async Task RunAsync(string endpoint, string key)
2829
{
2930
Console.WriteLine("Performing OCR on the images:");
30-
31-
string imageFilePath = @"Images\printed_text.jpg"; // See this repo's readme.md for info on how to get these images. Alternatively, you can just set the path to any appropriate image on your machine.
31+
// See this repo's readme.md for info on how to get these images. Or, set the path to any appropriate image on your machine.
32+
string imageFilePath = @"Images\printed_text.jpg";
3233
string remoteImageUrl = "https://github.com/Azure-Samples/cognitive-services-sample-data-files/raw/master/ComputerVision/Images/printed_text.jpg";
33-
//OCR works poorly for non-printed text. Look at the ExtractText sample for using the read operation that can work for both handwritten and printed text
34+
// OCR works poorly for non-printed text. Look at the ExtractText sample for using the read operation that can work for both handwritten and printed text
3435
await OCRFromStreamAsync(imageFilePath, endpoint, key);
3536
await OCRFromUrlAsync(remoteImageUrl, endpoint, key);
3637
}

0 commit comments

Comments
 (0)