steps
steps

Reputation: 804

Is there a way to use Google Colab Form feature in a local Jupyter Notebook?

I have just installed a Jupyter Notebook in a local conda environment, and I've imported an .ipynb file from Google Colab to run it locally.

I wonder if there's any extension that enables the Form feature from Google Colab to work on a regular Jupyter Notebook, using the same syntax, like this below: enter image description here

PS: I'm aware of the Jupyter Widgets (ipywidgets) package/extension, however the syntax is different from Colab Forms, ideally I would want to keep the same syntax so I could use the same file back and forth between Colab and local easily

Upvotes: 18

Views: 2675

Answers (2)

phi
phi

Reputation: 11704

Disclaimer: I'm the creator of ipyform.

You can use ipyform to render Colab forms in regular Jupyter and VSCode. It supports all Colab form annotations.

Add this to the top of your notebooks

# Install ipyform
%pip install ipyform

# Load the ipyform extension. This has no effect on Colab.
%load_ext ipyform
%form_config --auto-detect 1

For more details and examples, please refer to the repository’s README.

Upvotes: 2

Tedpac
Tedpac

Reputation: 1177

Disclaimer: this is not a strict solution to the problem presented by the OP, but it is a viable alternative.

For months I have been looking for a way to have certain Google Colab functionality locally, but to no avail. In particular, to date I haven't found a way to:

  1. Run Google Colab locally (offline).
  2. Have the functionalities of Google Colab forms locally (offline) using the same syntax.

However, since one of the main motivations for using Jupyter locally is to use the computational resources of the local machine, Google Colab offers a very simple way to take advantage of all the features of the platform using a local Jupyter environment:

  1. Upload your notebook to Google Drive and open it with Google Colab.
  2. Click the arrow next to the "Connect" button and then click "Connect to a local runtime".
  1. Follow the instructions.

Then you can use the same file back and forth between Google Colab and your local environment easily.

Result

Upvotes: 11

Related Questions