Unlocking the Power of AI Classification in Microsoft Power Apps: A Beginner’s Guide

Delve into the potential of AI classification within Microsoft Power Apps with our beginner-friendly guide. Learn to harness tools like AI Classify to effortlessly discern between continents, countries, states, and cities, streamlining your app development process.

AI prompt  act as straightforward instructions that we can go to Large Language Model(LLMs), leading to better results. The Power Platform provides various prebuilt Ai prompts that can be used within Power Apps and Power Automate solution. 

The available pre-built AI Prompts are, 

In this blog post, we focus on utilizing the Classify AI Prompt in PowerApps to identify the classifications based on given words or sentences and return the desired result. 

  • To get started, go to Microsoft Power Apps studio at https://make.powerapps.com 
  • Create new app in Tablet view mode and name it as Classify Analyzer 
  • Once you application is created, go to the “Data” option in the left menu. 
  • Then, select “Add data” and search for “AI Classify” under the data sources. 

Since I have enabled the modern controls in PowerApps application, proceed by adding the following controls 

S.NO  Control  Property 
1 Text Canvas Name: lblmInput Text: Enter Text To Classify Continent/Country/State/City
2 Text Input Name: txtmTextInput
3 Button Text: Classify Text , Name: btnClassifyText
4 Text canvas Name: lblmOutputTitle
5 Text canvas Name: lblmClassifyOutput

  • In the OnSelect property of a Button control (btnClassifyText), and add the following expression, 
Set(gbClassifyResult,'AI Classify'.Predict(txtmTextInput.Value,"Continent,Country,State,City"))
  • Initiate a global variable gbClassifyResult using the Set function and invoke the Predict function of the “AI Classify” connector. This function fetches the result and stores it in the new created variable. Ensure to provide the input text alongside the categories to be identified.
  • Next, choose the Text Canvas control (lblmClassifyOutput) control and assign the variable (gbClassifyResult) to its Text property by updating expression below. 
gbClassifyResult.Text

For example, we’ll use a word to classify whether it’s a Continent, Country, State or City. 

Enter Text as India and Click Classify Text button to predict and classify the entered text based on Input categories provided in Predict function.

We can use this feature to classify text, images and and other data types enables applications in spam filtering, content moderation, and personalized recommendation systems, revolutionizing user experiences across industries such as e-commerce, healthcare, and finance.

 

Shantha Kumar
Shantha Kumar
Articles: 295