Flask’s Latest Rival in Data Science

Streamlit Is The Game Changing Python Library That We’ve Been Waiting For

Developing a user-interface is not easy. I’ve always been a mathematician and for me, coding was a functional tool to solve an equation and to create a model, rather than providing the user with an experience. I’m not artsy and nor am I actually that bothered by it. As a result of this, my projects always remained, well, projects. It’s a bit of a problem.

As ones own journey goes, I often need to do a task that’s outside of my domain: usually to deploy code in a manner by which other people can use it. Not even to launch the next ‘big thing’, but just to have my mother, sister or father use a cool little app I built that recommends new places to eat. The answer always required more effort than I desired to put into it, which used to be:

  1. Develop a novel solution (my speciality) — [This I can do]

  2. Design a website using a variety of frameworks that require months of education [This I cannot do]

  3. Deploy code to a server on some web domain [This I can do]

So (2) is where I always lacked motivation because in reality, it wasn’t my speciality. Even if I did find the motivation to deploy some code, the aesthetics of my work would render it unusable.

The problem with using a framework like Flask is that just requires way too much from the individual. Check this blog here: clearly it’s ridiculous to have to navigate all that just to build a small nifty website that can deploy some code. It would literally take ages. And that’s why Streamlit is here.

On the comparison between Flask and Streamlit: a reader noted that Flask has capabilities in excess of Streamlit. I appreciate this point and would encourage users to look at their use cases and use the right technology. For the users who require a tool to deploy models for your team or clients, Streamlit is very efficient, however, for users who require more advanced solutions, Flask is probably better. Competitors of Streamlit would include Bokeh and Dash.


This is where Streamlit comes into its own, and why they just raised $6m to get the job done. They created a library off the back of an existing python framework that allows users to deploy functional code. Kind of similar to how Tensorflow works: Streamlit adds on a new feature in its UI, corresponding to a new function being called in the Python Script.

For example the following 6 lines of code. I append a “title” method, a “write” method, a “select” method and a “write” method (from Streamlit):

import streamlit as st

st.title(‘Hello World’)
st.write(‘Pick an option’)

keys = [‘Normal’,’Uniform’]
dist_key = st.selectbox(‘Which Distribution do you want?,keys)

st.write(‘You have chosen {}.format(dist_key))

Save that into a file called “test.py”, then run “streamlit run test.py” and it produces the following in your browser on http://localhost:8501 /:

Code above produced this. Fantastic how efficient Streamlits library makes UI programming.