Hello Fellow Automaters,
I'm running into an issue with calling the AI model (running a standard cats vs dogs detection using the Kaggle set).
When I open the file with the content to be detected with a manual trigger, it works fine
A very simple flow to open a file, and we see the contents of the file converted to base64, and passed on the AI Model. It runs without errors (except from detecting, need to add more samples ...)
Run the flow manually
The file is imported and the content is converted to base64, the content is passed on to the AI model
However, when I tried to post this same image as base64 content through a HTTP requests, the model refuses to accept the input and fails. Imho it is exactly the same content ( opened the image and used base64encode.org to encode it).
This is the HTTP flow request
The HTTP POST request I send from Postman
The HTTP requests gets processed normally and base64 encoded image is stored in the Image attribute
However when passing the Image to the AI model, it fails with a bad request, even though the content of the image attribute is exactly the same as when I'm running it with a manual trigger.
What am I doing wrong? HELP!
Solved! Go to Solution.
No, why would I do that? The AI model expects base64, not binary. I tried by sending a url to the JPEG image, downloading it with a HTTP GET requests and saving it locally on my OneDrive and passing that to the Model. Didn't work either. Or is there an image object that can open that JPEG file and pass that object to the model, like the open file manual method?
AI Builder actions require an explicit conversion to work properly.
I made the test with Form processing models and it worked (I think it's the same with object detection):
1- Converted my file using the base64 encoder you provided
2- Passed it as a string to my model fails as in your example:
3- If I convert the base64 to binary it now works properly:
Hope that helps solve your issue.
Can you just expand the F(x) for calling the Base64 on the Variable, for getting the correct syntax? Thx
I need to apply that on the image attribute. I get an error for F(x) Base64ToString('image')
Sure, I just converted the string variable representing the file: base64ToBinary(variables('MyFileBase64String'))
Let us know if that works for you!
Note that if the string representation of your file is within double quote you may get this error:
If possible try to avoid double quoting your string.
Learn how to create your own user groups today!
Check out the new Power Platform Community Connections gallery!
Congratulations, the new Super User Season 2 for 2021 has started!
Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.