colab + flask

REST API in Google COLAB

In this tutorial, I will explain how to expose the rest api using python flask in Google Colab.

I have used ngrok for making the public ip from our local. So download the ngrok and extract it.

!wget https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-linux-amd64.zip!unzip -o ngrok-stable-linux-amd64.zip

‘!’ command used for run the linux command in colab jupyter

from IPython import get_ipython

‘get_ipython’ used for run the linux command in background

app.py

In the jupyter 6 and 7 cell used for run the flask app.py and ngrok

Cell 8 used for see the public ip. Once you got the ngrok public ip, paste into the browser and see the output.

This is the complete google colab code.