Adding a Machine Learning model made with Python into your Mendix app
We’re building a website that will need to integrate a Machine Learning model (that has been coded in Python), and I’m not sure how we can do this. My initial idea was to create an API following something like this (https://ubiops.com/building-a-low-code-app-powered-by-ai/), but I don’t want to rely on external tools like UbiOps. So I tried to make my own Python API from scratch using Flask, like here (https://www.datacamp.com/community/tutorials/machine-learning-models-api-python). The API is functional, but I’m not sure how to pass the input from Mendix. I try using the “call REST” action in a microflow, using a POST method, but it seems I can’t get it to pass the input. I’m trying to use an export mapping to pass the JSON you see in the previous link, but I don’t find any documentation to do this. There’s also the idea to call a Java action, that will in turn call the Python model, like they mention here (https://forum.mendix.com/link/questions/101581). I haven’t tried this yet, though. Any idea what would be the best way to proceed?
Alfonso Domínguez de la Iglesia
If you go into your Mendix console, and set the Log Level for the “REST Consume” node to “TRACE” you can see the request and response when Mendix tries to call the service you’ve built. This should let you know what is going on. Can you share an example request and response if you are still stuck?