there is an api called Unity ML-Agents, which allows to do this.
It's running in real time.
Thanks a lot!
Glad you liked it! <3