Build a Web App with Python’s Flask on Google Colab in 2 Minutes

Nandhini Swaminathan
The Research Nest
Published in
2 min readSep 4, 2021

--

Today we’ll see how to build a quick web application using Google Colab and Flask API.

This approach is beneficial when you have to demonstrate your web app, which requires high computational power (like object detection or image classification projects) to your colleagues before deploying it into production.

While working on a project, if you want to create an API for your portfolio site, Flask is one of the best options you have. Simple and light, it’s easy to use! This framework provides functionalities such as handling HTTP requests and rendering HTML templates.

Google Colab on other hand, provides a virtual machine with unlimited computational capacity. However, while using it we cannot access the localhost as we do on our local machine.

Here is where ngrok comes in, it enables your locally-hosted web server to be hosted on a subdomain of ngrok.com thereby exposing a local development server to the internet through a public URL. So let’s begin by installing flask-ngrok in our Colab notebook:

!pip install flask-ngrok
!pip install flask-bootstrap

After the libraries are installed, we’ll continue by building a simple Flask app using flask-ngrok:

--

--