Ipywidgets with Google Colaboratory
I think now Ipywidgets is working with Google Collaboratory. I tested some decorators and it ran smoothly.
Your code has resulted in:
Update 2: core ipywidgets
now work in Colab, as do many custom widgets! In particular, the base, controls, FileUpload, Image, and output widgets all work in colab. See https://github.com/googlecolab/colabtools/issues/498 for more details.
(Tweaked original answer): ipywidgets
don't Just Work with Colab: we have a different security model, wherein each output is in its own iframe (with a different origin than the main Colab page). This prevents ipywidgets from working without changes on the Colab side.
!pip install ipywidgets
# this will allow the notebook to reload/refresh automatically within the runtime
%reload_ext autoreload
%autoreload 2
from ipywidgets import interact
def f(x):
return x
interact(f, x=10)