Please wait, loading...

 

Image Classification model by Microsoft Lobe in Power Apps – Part 2

March 26, 2022

In our previous blog, we have seen how to create an Image Classification model by using Microsoft Lobe. Microsoft supports the Image Classification model in Power Apps and Power Automate. In this blog, we will see how we can use the model in Canvas app.

To configure the model in Canvas app, follow the steps given below:

  • To export the model, click on the Menu icon and then click on the Export

Microsoft Lobe in Power Apps

  • Now click on the configure button to configure your CRM instance.

Microsoft Lobe in Power Apps

  • Give the model a name and then click on the Export button.

Microsoft Lobe in Power Apps

  • After clicking on the Export button a pop-up would open asking if you want to Optimize & Export the model or simply export the model as it is. I recommend choosing Optimize & Export.

Microsoft Lobe in Power Apps

Microsoft Lobe in Power Apps

  • Now create a Canvas app. To know more on how to create a Canvas app kindly follow this link.
  • Now, we will add our model to our Canvas app. To add the model, click on the Data icon -> Expand AI models section -> If you didn’t find the model then click on the See all models text.

Microsoft Lobe in Power Apps

  • Once you add the model it would be visible under Data.

Microsoft Lobe in Power Apps

  • After creating the Canvas app add a Camera control to take images.

Microsoft Lobe in Power Apps

  • OnSelect event of the Camera control add the below code.

        ClearCollect(modelPred, ‘Work Attire Detection’.Predict(MyCam.Photo).Prediction);

  • The modelPred is a collection where the prediction would be stored and MyCam is the camera control name and the Work Attire Detection is our model name.

Microsoft Lobe in Power Apps

  • Now add a Gallery control to show the model prediction result.

Microsoft Lobe in Power Apps

  • Set the data source to the collection which we created i.e. modelPred.

Microsoft Lobe in Power Apps

  • Set the Layout to Title only.

Microsoft Lobe in Power Apps

  • Once this is done you can test the Canvas app to check whether it is working or not.

3Microsoft Lobe in Power Apps

Conclusion:

In this blog, we have seen how easy it is to use the Image detection model in Canvas app. Based on the Business use case you can provide the images to the model from various places and get the prediction in Canvas app.

Go to Source and hit them a thumps up

https://i0.wp.com/microsoftdynamics.in/wp-content/uploads/2020/04/Microsoftdynamics365.png?fit=640%2C651
Microsoft Dynamics Community Profile

Learn more