Sam's Microsoft Dynamics 365 Blog

Tuesday, 8 October 2019

Using Computer Vision Inside Microsoft Flow(AI in Microsoft Flow)

Microsoft has introduced AI services called “Cognitive services”. There are various services categorized by Vision APIs, Speech APIs, Language APIs, and Search APIs which belong to Cognitive Services. These services can be integrated with many platforms very easily. You can find more about Computer Vision https://azure.microsoft.com/en-in/services/cognitive-services/computer-vision/

In this article, I will be demonstrating how to use the Azure Computer Vision with Microsoft Flow.

Here I am using a scenario, An Image is uploaded to SharePoint Document Library, using Azure Cognitive services image content will be converted in text format and sent the text content via email.

So, let’s start step by step.

1. Generate Cognitive Service API Key and URL:-

First, we must generate the API key for Cognitive Service. So, for that

a. Login into the Azure account.
b. Now In the left navigation, click Create a resource.
c. In Azure Marketplace, select AI + Machine Learning and then click Computer Vision.
d. Enter the required details as shown below and click Create.
e. Click on All Resources in the left navigation and then click the newly created computer vision resource.
f. Now Click Keys under Resource Management, copy the Key.

Note: - It might take a few minutes to deploy the resource.


There is another option to generation Cognitive Service API key. We can register a trial through https://azure.microsoft.com/en-in/services/cognitive-services/computer-vision/.



2. Create a Microsoft flow:-

a. Go to https://us.flow.microsoft.com/en-us/
b. Click on My flows and then Click on create from the blank.
c.  Select SharePoint and Select a Trigger “When a file is created in a Folder”.


d. Now Select Site Address and Folder Id. Here I am Selecting the Invoice folder.



e. Add a new step, Select Computer Vision and Select Action “Optical Character Recognition (OCR) to Text”.


f. Now Put Connection Name, Account Key (Generated previously in Azure) and Site URL and click on Create.


g.  Select “Image Content” as Image Source and “File Content” as Image Content.


h. Add a new step, Select Office 365 Outlook and Select Action “Send an email”.


i. Now add recipient of the email in “To”, Put File name as “Subject”, Detected Text as “Body”.

j.  Inside attachments put File name in “Attachments Name” and File Content in “Attachments Content”.

Now let’s test. I have uploaded an Invoice Image to my Invoice Document Library.


Now we can check the content of Image inside flow output.


Also, I have received an email of the Image content of uploaded Invoice Image.



Sources: -
 https://azure.microsoft.com/en-in/services/cognitive-services/
https://azure.microsoft.com/en-in/services/cognitive-services/computer-vision/
https://docs.microsoft.com/en-us/azure/cognitive-services/welcome
https://docs.microsoft.com/en-us/flow/get-started-logic-flow


 Thanks for reading the article. Hope this Article will helpful for you. Cheers!!!

Web Resource vs PCF vs Canvas App - which of the one is used?

While started working on specific Business Requirements related to custom layout, there is a always common question that "where to star...