Name 'widgets' is not defined & taking lot of time to run the fastbook ch-1 on colab

It just happened to me in paperspace: https://nmf7d80p.gradient.paperspace.com/notebooks/fastbook/01_intro.ipynb

I searched for information about widgets in jupyter and gradient and found this:

https://ipywidgets.readthedocs.io/en/stable/examples/Widget%20Basics.html

Using that information I added the following line:

import ipywidgets as widgets

to the existing code so that it is now:

#hide_output
import ipywidgets as widgets
uploader = widgets.FileUpload()
uploader

and it ran and I could upload my image. So, if others are having that problem, try adding that import statement.

34 Likes