You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+15Lines changed: 15 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,3 +1,18 @@
1
+
---
2
+
page_type: sample
3
+
languages:
4
+
- csharp
5
+
- html
6
+
- java
7
+
- javascript
8
+
- swift
9
+
- python
10
+
products:
11
+
- azure
12
+
description: "This repo provides code samples for cognitive services APIs."
13
+
urlFragment: cognitive-services-REST-api-samples
14
+
---
15
+
1
16
# Samples for REST APIs in Cognitive Services
2
17
3
18
This repo provides code samples for cognitive services APIs. There are sections for Language, Search, and Vision APIs using various progamming languages. Note that these are just simple wrappers to the APIs. For SDKs and SDK samples there are separate repos. You can check out all cognitive services APIs here: https://azure.microsoft.com/en-us/services/cognitive-services/. You can check out detailed documentation of these APIs here: https://docs.microsoft.com/en-us/azure/#pivot=products&panel=cognitive.
publicconststringsubscriptionKey="<your training key here>";//Insert your Cognitive Services subscription key here
14
-
publicconststringendpoint="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
stringimageFilePath=@"Images\faces.jpg";// See this repo's readme.md for info on how to get these images. Alternatively, you can just set the path to any image on your machine.
30
+
// See this repo's readme.md for info on how to get these images. Or, set the path to any image on your machine.
publicconststringsubscriptionKey="<your training key here>";//Insert your Cognitive Services subscription key here
15
-
publicconststringendpoint="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.
14
+
// Add your Azure Computer Vision subscription key and endpoint to your environment variables
Console.WriteLine("Extracting text from the images:");
31
-
32
-
stringimageFilePath=@"Images\handwritten_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.
32
+
// 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.
publicconststringsubscriptionKey="<your training key here>";//Insert your Cognitive Services subscription key here
14
-
publicconststringendpoint="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
stringimageFilePath=@"Images\objects.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.
publicconststringsubscriptionKey="<your training key here>";//Insert your Cognitive Services subscription key here
14
-
publicconststringendpoint="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.
13
+
// Add your Azure Computer Vision subscription key and endpoint to your environment variables
publicconststringsubscriptionKey="<your training key here>";//Insert your Cognitive Services subscription key here
14
-
publicconststringendpoint="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
Console.WriteLine("Get area of interests in images:");
30
-
31
-
stringimageFilePath=@"Images\objects.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.
publicconststringsubscriptionKey="<your training key here>";//Insert your Cognitive Services subscription key here
14
-
publicconststringendpoint="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
publicconststringsubscriptionKey="<your training key here>";//Insert your Cognitive Services subscription key here
14
-
publicconststringendpoint="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
Console.WriteLine("Performing OCR on the images:");
30
-
31
-
stringimageFilePath=@"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.
//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
publicconststringsubscriptionKey="<your training key here>";//Insert your Cognitive Services subscription key here
14
-
publicconststringendpoint="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
+
14
+
// Add your Azure Computer Vision subscription key and endpoint to your environment variables
Console.WriteLine("Recognize domain specific content (celebrities/landmarks) in images:");
30
-
31
-
stringimageFilePath=@"Images\landmark.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.
32
+
// 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.
publicconststringsubscriptionKey="<your training key here>";//Insert your Cognitive Services subscription key here
15
-
publicconststringendpoint="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.
Console.WriteLine("Recognizing text from the images:");
31
-
32
-
stringimageFilePath=@"Images\handwritten_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.
awaitRecognizeTextFromStreamAsync(imageFilePath,endpoint,key,"Handwritten");//the last parameter is whether the text that has to be extracted is printed or handwritten
0 commit comments