• Yash Agarwal

Text Recognizer and Translator using Power Apps and Azure Cognitive Services

In this #PowerShot I will show you how to use Text Recognizer (AI builder feature) along with Azure Cognitive Services to build a translator app using Power Apps.


Let's Get Started!


We will use an image with text in English language and use the Text Recognizer feature to recognize and extract text from the image. This extracted text will then be translated to a language of choice using the Microsoft Translator API in Azure Cognitive Services.

Power Apps


We will create a canvas app and use the Text Recognizer AI Builder feature to recognize text from an image.

Step 1: This is the Text Recognizer control that is selected from the AI Builder feature in Canvas Apps. This control is used to select and scan the image for extracting the text.


Step 2: This is a combo-box control that is used to display and select the language in which the translation needs to be done. The items on this control are populated using a collection created at "App Start". The expression used at the "OnStart" property of the app is:

Expression: ClearCollect(Languages,{DisplayName:"Hindi",LangCode:"hi"}, {DisplayName:"French",LangCode:"fr"},{DisplayName:"Spanish",LangCode:"es"},{DisplayName:"German",LangCode:"de"})


Step 3: This is a button control. On the press of this button, the text from the text recognizer output is collected into a collection and then translated to the language selected from the step 2 using the Microsoft Translator API. The expression used on the "OnSelect" property of this control is:

Expression: ClearCollect(CollectedText,TextRecognizer1.OcrObjects); ClearCollect(ReturnedResponse,MicrosoftTranslatorV2.Translate(ComboBox1.Selected.LangCode,Concat(CollectedText,text," ")))


NOTE: As the text recognizer reads each line as a separate element, we are using the "concat" function to join each line from the extracted text.


Step 4: This is a Text Label control that displays the returned text from the Microsoft Translator API.

Microsoft Translator API


Step 1: Create a "Translator Text" resource in Azure.


Step 2: Create a connection to the MS Translator API in Power Apps and pass the Key while creating the connection.

For more detail on the MS Translator API, refer the documentation here.

Setup in Action

In this post we saw how to use the text recognizer feature in Power Apps that enables the OCR capabilities and helps extracting text from images and translate that to a language of choice using the Microsoft text translator API. This setup and the enhanced capabilities of the PowerPlatform can be used for multiple application areas such as recognize text from medical prescriptions at medical stores, recognize text from receipts, text to speech (for reading text from an image) and etc.


I hope you found this is interesting and it helped you!

Recent Posts

See All

Working with Throttling Limits in Power Automate

In this #PowerShot, I will show you how to better handle throttling limits for API requests actions, connectors and flow runs in Power Automate. Let's Get Started Connectors in Power Automate have a s

SUBSCRIBE VIA EMAIL

Yash Agarwal

  • Black LinkedIn Icon
  • Black Twitter Icon
  • Black Facebook Icon
  • Black Instagram Icon
  • Black RSS Icon

© 2019 By the Devs