🏠 back to Observable

Running Google Colab from Observable (or vice versa)

Does anyone know if it is possible to run a Google Colab notebook from Observable? I’m guessing that it is not possible.

I was thinking it would be useful to have Observable send data to a Google Colab notebook (to run a Python script for data pre-processing) and then have the data sent back to Observable for visualization.

1 Like

I think colab resists automation explicitly (e.g. can’t login to run it with a service account).

A workflow I think is possible would be

  • run colab script manually that writes to a cloud bucket
  • observable reading from cloud bucket
1 Like

hi @cornhundred,

Could one craft a client-server python code that communicates with the jupyter-kernel to receive data from Observable?

You gave me an idea: try to serve a simple web server from one Colab instance and fetch data directly from an Observable notebook. Using ngrok.com with Flask

The Flask web server can be improved a lot and how it’s integrated to Colab workflow. Anyway, it’s just a PoC. It relies on ngrok.com as a reverse proxy.

Run this Colab notebook, copy and paste the generate ngrok.io URL to the Observable notebook below. It serves a CSV file with embeddings data from a PyMDE MNIST analysis. This workflow is a bit quicker than exporting a CSV file and importing on Observable. But it’s not faster than using Observable inside Colab with observable-jupyter made by ObservableHQ folks.

Another helpful hack: it’s easy to connect via ssh to a Colab instance. I use another service for reverse proxy tmate.io

edit: I forgot to mention a previous post here that might be helpful


Thanks @radames for all the links and examples! The ngrok example is great. I wonder if there is a way to make the ObservableHQ notebook results persistent (other than downloading a file from colab and uploading to Observable)?

The observable-jupyter is very cool. I made this Colab notebook that generates heatmaps from this Observable notebook