I once setup a genetic algorithm running in Heroku. See
https://minme.herokuapp.com/. It is quite simple to build if you use Flask for the API and Python for the machine learning in the backend.
So, to answer your question, such a service could be built on top of Heroku. I'm just not sure if Heroku can provide the performance you're looking for.