I created a proof of concept about using a Google Colab Notebook with a defold application :

I used some tricks:

  • the colab notebook have to expose web services through a tunnel => I choose FastAPI (a web framework for building APIs with Python) and JPRQ (a free and open-source Ngrok alternative for Python)
  • the defold application needs to:
    ** connect to the colab web server => thanks to the qrcode extension, I use a qrcode to share the url between colab notebook and the defold application
    ** manage asynchronously web requests => I choose to use the webview extension and its callback mechanism
    ** check if the colab web server is still available => I choose to use a kind of heartbeat mechanism (aka ping the server at regular interval)

Actualy the colab notebook is very basic, it only returns the size of the image…
but you can do more, generating a textual description for the given image for example ;o)