Back to Cog

notebook

examples/notebook/README.md

0.21.0743 B
Original Source

notebook

A simple example using a Jupyter Notebook with Cog

Usage

First, make sure you've got the latest version of Cog installed.

Run the Jupyter Notebook server with Cog:

sh
cog run -p 8888 --debug jupyter notebook --allow-root --ip=0.0.0.0 --NotebookApp.token=mytoken

Copy the notebook URL to your browser (you can change the mytoken to your preferred token or have it autogenerated):

sh
http://127.0.0.1:8888/?token=mytoken

Save any changes you make to your notebook, then export it as a Python script:

sh
jupyter nbconvert --to script my_notebook.ipynb # creates my_notebook.py

Now you can run predictions on the model:

sh
cog predict -i name=Alice