Azure Logic App: Utilizing Cognitive Service Computer Vision and Text Analytics API

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 our workflows without writing a single line of code.

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

Here, we will see how to convert OCR files to Text files automatically.

Create a Logic Flow to convert an OCR File to Text

Here, we need to connect to DropBox, Storage (Blob), Microsoft Cognitive Service (Computer Vision and Text Analytics), and OneDrive.

Prerequisites

  • Microsoft Azure Account
  • DropBox Account
  • OneDrive Account

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

Step 1. Create Microsoft Cognitive Service Optical Character Recognition(OCR) to Text.

Log into https://portal.azure.com/

  • On the dashboard, search for "AI + Machine Learning" and click on "Computer Vision".
    AI + Machine Learning
  • Enter the name, subscription, pricing tier, and resource group for the Computer Vision API then, and click on "Create".
    Create
  • Under Keys, you have keys for accessing the Computer Vision.
     Computer Vision

Step 2. Create the Storage Account.

  • On the dashboard, select "Create a resource" and click on "Storage" Now, choose Storage account.
    Storage account
  • Enter the name, subscription, location, and Access tier then, click on "Create".
     Access tier
  • Create the container.
    Container
  • Open up the container and choose properties there we have a storage URL.
    Storage URL

Step 3. Create a Cognitive Service for Text Analysis.

  • In the dashboard, select "Create a resource" and click on "AI + Machine Learning" Now, choose text Analytics to create the Cognitive Service
    Cognitive Service
  • Enter the name (TextACog) you want to assign to Text Analytics, choose the subscription and resource group where you organize related resources, and the location where your logic app is stored and the pricing tier then, click on "Create".
    Text Analytics
  • Under the Keys, you have keys for accessing the Text Analytics.
     Text Analytics

Step 4. Now, let us create the Logic App for converting the OCR File to Text and store it on the OneDrive.

  • In the dashboard, choose 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, resource group where you organize related resources, and location where your logic app is stored then, click on "Create".
    Create
  • Here is the dashboard Click on Logic App Designer.
     Logic App Designer

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

Blank Logic App

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

  • Search DropBox on the search bar.
     DropBox
  • Choose the Triggers tab.
    Triggers tab
  • Next, let us sign in.
    Sign in
  • Give permission to access our accounts.
    Access our accounts
  • Next, Choose the Folder name where you upload the images then, give the time interval and frequency for checking the workflow as one minute.
    Choose Folder

Step 7. 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.
    Blob content

Step 8. Configure the computer Vision API for detecting the sentiment of the tweet.

  • Search for Computer Vision.
     Computer Vision
  • Choose the Action.
    Choose the Action
  • After that, give the Cognitive Service Connection name and key.
    Cognitive Service Connection
  • Configure the condition.
    Configure the condition

Step 9. Configure the Text Analytics for detecting the Language.

  • Search for Text Analytics.
     Text Analytics
  • Then, choose an Action for the workflow.
    Action for the workflow
  • Next, choose the detected text.
    Detected text

Step 10. Configure the Text Analytics for detecting the Key Phrases.

  • Choose an Action for the workflow.
    Key pharases
  • Next, choose the detected text
    Detected

Step 11. Configure the Text Analytics for detecting the sentiment of the tweet.

  • Search for the detected sentiment.
    Detect sentiment
  • Choose the Action.
    Preview
  • Next, choose the detected text
    Choose detected text

Step 12

  • Next, we want to save that value into the Excel sheet, so search for Excel Online.
    Excel Online
  • Then, choose the Action for the workflow.
    Add row
  • Next, we sign in to OneDrive.
    Sign in
  • We give permission to access our accounts.
    Permissions
  • Next, Choose File Name and Table Name to save the Image values then, Choose the Fields that you want.
     Choose the Fields
  • Our Final WorkFlow Will be like this
    Final WorkFlow

Step 13. Now, we need to save the workflow and run it.

Workflow and run 

Output

Save an Image in the DropBox.

DropBox

Image

Image

Now, it extracts the Content, detects language, Keyphrases, and Sentiment values, and saves those in an Excel Sheet (OneDrive).

Excel Sheet

Summary

I hope you understand how to Convert the text presented in the image to digital format and save the output into an Excel file with the detection of Language, sentiment, and key phrases using Microsoft Cognitive Services in Azure Logic App automatically. Stay tuned for more.