Using Cognitive Service Face API with Azure Logic App

Azure Logic Apps

Logic App is a cloud-based service. It allows us to react to an event in one service (such as SharePoint online) and do something with the data from that event in another service (such as Twitter). It makes it practical and simple for business processes. The users build workflows that automatically perform some business tasks and processes across applications and services. We can connect our business-critical apps and services with Azure Logic Apps, automating workflows without writing a single line of code.

Before reading this article, please go through some important article links, mentioned below.

Face API

Here, we can detect the face in the image. Whenever you upload the images in the dropbox, the Face API detects the values like Gender, Age, Beard, Glasses, Smile, etc., and stores the values in the Excel file.

How to use Face API in Azure Logic App?

Here, we need to connect DropBox and Onedrive to access Face API.

Prerequisites

  • Microsoft Azure Account
  • DropBox Account
  • Microsoft OneDrive Account(Excel Sheet)

Follow the below steps to build a Workflow using a template.

Step 1. Create the Cognitive Service. Login to https://portal.azure.com/

  • In the dashboard, select "Create a resource" and click on "AI + Machine Learning". Now, choose "Face" for creating the Cognitive Service.
    Machine Learning
  • Enter the name you want to assign to the Face API, choose the subscription and resource group where you organize the related resources, and location where your logic app would be stored, and the pricing tier. Then, click on "Create''.
    Create
  • Under the Keys, you have keys for accessing the Face Detection.
    Face Detection

Step 2. Create the Storage Account

  • In the dashboard, select "Create a resource" and click on "Storage". Now, choose Storage account.
    Create a resource
  • Enter the name, subscription, Location, and Access tier. Then, click on "Create".
     Access tier
  • Then create the container.
    Create the container
  • Container Created.
    Container
  • Open up the container and choose properties. There we have a storage URL.
    Storage URL

Step 3. Now, let us create the Logic App for detecting the face in the image and storing the values on the Excel Spreadsheet.

  • In the dashboard, choose to create a resource and click on Integration. Now, choose Logic App.
    Logic App
  • Enter the name you want to assign to the logic, choose the subscription, the resource group where you organize related resources, and the location where your logic app is stored. Then, click on "Create".
     Assign to the logic
  • Here is the dashboard. Click on Logic App Designer.
    Dashboard

Step 4. Now, click on the Blank Logic App.

Blank Logic App

Step 5. Configure the data by signing into DropBox and Excel Online.

  • Search DropBox on the search bar.
    DropBox
  • Choose the Triggers.
    Triggers
  • Next, we sign in.
    Sign in
  • We give permission to access our accounts.
     Permission
  • Next, Choose the Folder name where you upload the images.
    Folder name

Step 6. Configure the Blob Storage

  • Search Blob Storage
    Blob Storage
  • Choose the Storage Connection
    Storage Connection
  • Next, Choose the folder path, Blob name,and Blob content.
     Folder path

Step 7. Configure the cognitive Face API for detecting the Face in the Image.

  • Search for Face API.
    Face API
  • Choose the Action.
    Action
  • After that, give the Connection name, API Key and Site URL from Face API Cognitive Service.
    API Key
  • Now, enter the Blob storage link and choose the path in the image URL.
    Blob storage link

Step 8

  • Next, we want to save that value into the Excel sheet, so search for Excel Online.
    Excel sheet
  • Then, choose the Action for the workflow.
    Workflow
  • Next, we sign in to OneDrive.
    Sign in to OneDrive
  • We give permission to access our accounts.
    Accounts
  • Next, Choose the File Name and Table Name to save the Image values. And, Then, Choose the Fields that you want
    Image values
  • The final Workflow will be like this.
    Create Blob

Step 9. Now we save and run the workflow and run it.

Save and run

Output

Upload the image in the DropBox.

Upload the image

Now, the values are saved in Excel.

Values

Logic App Evaluation.

 App Evaluation

Summary

I hope you understand how to use Face API and store the values in the Excel spreadsheet automatically and how to run it. Stay tuned for more.