Run localhost server in Google Colab notebook

You can do this by using tools like ngrok or

They give you a URL that you can access from any browser to access your web server running on 8888

Example 1: Tunneling tensorboard running on


get_ipython().system_raw('tensorboard --logdir /content/trainingdata/objectdetection/ckpt_output/trainingImatges/ --host --port 6006 &')

get_ipython().system_raw('./ngrok http 6006 &')

! curl -s http://localhost:4040/api/tunnels | python3 -c \
 "import sys, json; print(json.load(sys.stdin)['tunnels'][0]['public_url'])"

Running this install ngrok on colab, and makes a link like

Documentaion for NGROK

Another way of running a publicly accessible server using ngrok:

!pip install pyngrok --quiet
from pyngrok import ngrok

# Terminate open tunnels if exist

# Setting the authtoken (optional)
# Get your authtoken from

# Open an HTTPs tunnel on port 5000 for http://localhost:5000
public_url = ngrok.connect(port="5000", proto="http", options={"bind_tls": True})
print("Tracking URL:", public_url)