Use your model

Completed

Learn how to use your Document processing model in Power Apps.

Quick test

After your model completes training, you can view important details about your newly trained model on a details page.

Screenshot of your newly trained model details page.

To see your model in action, select Quick test.

Drag and drop or upload an image from your device to test. From the previous sample data, use the files from the Test folders that we didn’t use for training (either from AI Builder Document processing Sample Data\Adatum\Test or AI Builder Document processing Sample Data\Contoso\Test).

You can now view the detected fields that you chose and the associated confidence scores for retrieving the individual fields compared to the trained model.

Publish your model

Your model can't be used until you publish it. If you're satisfied with your model, select Publish to make it available for use.

Use your model in Power Automate

Now that your model is published, you can use your Document processing model to process documents using Power Automate. A special AI Builder action can be used to ingest documents from emails, document libraries, and other sources, and output the processed data.

  1. Select Use model.

  2. Select Build intelligent automations and select one of the triggers proposed. For this module, we use the Microsoft 365 Outlook work account.

  3. Make sure that you're signed into the flow and then select Continue to confirm the creation of the flow.

    The flow is already configured to run when you receive an email with an attachment and the email subject is: AI Builder. Let's see it in action!

    Screenshot of sample flow illustrating how to use your newly trained model.

  4. Select Save on the top right to test the flow.

  5. Select Test.

  6. Select Manually and then select Test.

  7. Now send yourself an email with the subject AI Builder and attach the document you used for quick test previously.

  8. After a few seconds, you see the flow running. The flow extracts the data from the attachment and sends you back an email with the results.

Congratulations! You built an intelligent automation flow. You can then customize the flow to your needs to perform any other action you might want.

Use your model in Power Apps

Now that your model is published, you can use your Document processing model in a canvas app. A special component is available for you to add that analyzes any image and extracts the text based on your trained Document processing mode.

  1. From the Power Automate home page, select AI Hub, and select your model under Recently Created.

    Screenshot of where to access AI Models.

  2. Select Use model.

    Screenshot of where to select Use Model.

  3. Select Build intelligent apps to begin the canvas app creation experience.

    Screenshot of selecting build intelligent apps.

  4. Within your canvas app, a Form processor component is automatically added and linked to your published Document processing model.

    Note

    If you want to add additional AI models to the app, select Insert and then select Form processor to add a Form processor component. Next, select the AI model property from the right hand properties panel. A list of AI models appears to select. Only published models appear in the drop-down list.

    Screenshot of published models appearing in the drop-down list in Power Apps.

  5. Next, we select which field from the invoice to display. Select Insert and then add a Label component.

  6. With the label selected, make sure that Text property is selected in the top left hand corner. In the formula bar, write FormProcessor1.Fields. This code gives you access to the other properties from the model as well. For this exercise, we choose Invoice Number. The result looks similar to this image.

    Screenshot of a field name in the Fields property in Power Apps.

    Note

    Notice how 'Invoice Number' is in single quotes in the previous image. This is because when the Invoice Number column was created, the column name was created with a space in between the words. If your columns weren't created with spaces, you don't need the single quotes and your code may look like this image instead.

    Screenshot of InvoiceNumber without spaces.

  7. Next we add a gallery so we can see the data from the items of the invoice. Select Insert and then Vertical Gallery.

  8. In the Items property of the gallery, write: FormProcessor1.Tables.Items

    Screenshot of the gallery and the formprocessor1.Tables.Items.

  9. Select Play on the upper right of the Power Apps studio to preview the app.

  10. Select Analyze and then select the image that you used to quick test previously.

    Screenshot of Analyze.

    A preview of your document shows the Invoice Number and the items from the invoice.

    Screenshot of gallery items and invoice number from invoice.