Introduction
The Azure Cognitive Services Face API provides algorithms that are used to detect, recognize, and analyze human faces in images. The ability to process human face information is important in many different software scenarios. Example scenarios are security, natural user interface, image content analysis and management, mobile apps, and robotics. In this example, we will see that when a user uploads an image in the document library, the MS flow will be triggered and sends an email about the analysis of the image.
Steps to create the Face Api resource in Azure portal
If you do not have an Azure subscription, create a
free account before you begin.
Step 1
Login to your Azure account. Click "Ccreate a resource" and select “AI + Machine Learning”. Then, select “Face" as shown in the image.
Step 2
On the Create page, provide the following information.
Name
|
A descriptive name for your cognitive services resource. For example Facedetection.
|
Subscription
|
Select one of your available Azure subscriptions.
|
Location
|
The location of your cognitive service instance. Different locations may introduce latency, but have no impact on the runtime availability of your resource.
|
Pricing tier
|
The cost of your Cognitive Services account depends on the options you choose and your usage. For more information, see the API pricing details.
|
Resource group
|
The Azure resource group that will contain your Cognitive Services resource. You can create a new group or add it to a pre-existing group.
|
Step 3
After creating your resource, you can access it from the Azure dashboard if you pinned it. Otherwise, you can find it in Resource Groups. After selecting your resource, you can get the keys by selecting Keys under Resource Management.
Step 4
Now, create your MS flow from the SharePoint document library. I have chosen the option “When a new file is added in SharePoint complete a custom action” .
Step 5
Now, edit the flow that is created and select the "Detect faces" connector.
Step 6
As mentioned in step 3, take the endpoint URL and the resource API name and Key from Azure portal.
Step 7
In MS Flow, configure the properties of the Face API by passing the connection name, API key. and the site URL (endpoint).
Step 8
If the connection is successful, you will get the option to enter the Image URL. Here, I have passed the item URL which will be an image.
Step 9
From the properties generated, I am taking gender and age and assigning to an indivdual variable.
Step 10
Finally, I added a step to send an email to the "Created by" user with the analysis.
Step 11
When the flow is triggered, you can see the properties and the email that is generated.