The timing could not have been better. As I was searching for ways to deliver interactive content for the 123AI blog, a young startup, streamlit, appeared with a firework of articles, posts, interviews on social media and beyond. Immediately, it became clear that this is the very tool I was missing the whole time. The last missing piece, at least in my mind, to make this blog something special.

What is Streamlit?

Streamlit has very strong backing and was founded by three battle-proven industry veterans: Adrien Treuille (Google X project lead), Thiago Teixeira (Founder of Hangout Chats by Google), and Amanda Kelly (Product owner at Google X). No wonder that there is such a fuzz around the company and the product. If you like it or not, the team and the professional network still matters most. The following statement is, how the company thinks of themselves:

Streamlit is company of tinkerers, engineers, and scientists. We believe that machine learning engineers deserve blazingly fast, fun, and interactive tools. Together, we are building the world’s most beautiful tool for machine learning engineers. Welcome to programming 2.0.

From https://streamlit.io/about/

The product, streamlit, is a Python framework build around a lightweight webserver to turn your code into beautiful, interactive web applications. These apps look and feel more like polished products rather than crude prototypes. Even better, not much code overhead is needed and streamlit will take care of everything. This includes speedup tricks using caching as well as always using your latest code version when you pull it from git. Sounds awesome? Well, it certainly is and I can not emphasize enough on how fast and with how little resources you can build impressive looking web applications. Now, how does it compare to the usual suspects?

Why not Jupyter notebooks?

Jupyter notebooks are also great! In fact, they are so powerful and versatile that we at 123AI.de use them ourselves for educational purposes, for our member services, and for corporate training. They are highly customizable and interactive, have a huge following and come in different shapes. However, they do not serve the same purpose: streamlit is rapid prototyping and delivering applications while Jupyter notebooks are still made for programmers and enthusiasts and you could think of it as a pumped up IDE.

How does 123AI use streamlit?

First off, I started by renting an online vServer at a prepaid hoster (no sponsoring, no affiliate link) for a very low monthly cost. The server should have multiple CPUs and enough memory to support streamlit and possibly JupyterHub. For testing, I started with a 2 CPU and 4GB RAM vServer for a very cost-efficient 5.31 EUR per month. As traffic increases, upgrading to a larger system is a necessity and should be easy up to a certain point.

Having root access, I installed Ubuntu 18.04 with on click on the command console and installed some of the fundamental Linux tools as well as a current version of anaconda. From here, it was really a piece of cake as installing streamlit is nothing more than a pip install streamlit. Starting the service is as easy as installing it. streamlit hello will start the webserver and showing some examples which you can access and manipulate from outside. You might want to start the service within a screen session to make sure it still stays alive even when you log out.

Instead of using the IP address and port directly, I bought a domain and set up a subdomain redirect. For accessing multiple streamlit apps, each of them will live on another port and get another subdomain redirect. Finally, to include and use it on the blog, I use the advance iframe plugin for WordPress. Now, it is possible to launch and show an app with a single line of code in any article.

If you want to know more about the inner workings of streamlit, please check out their API. I highly recommend to check out this introductory article by Co-founder Adrien Treuille. If you want to check out a working example, please have a look at our post on Know your distributions. For our members, all streamlit applications source codes are available as part of the 123ai-content package under streamlit-apps.

Any problems and missing features?

Well, there are a few. Being such a novel product, streamlit is actively developed and far from mature or feature complete. That being said, they really care about their community and I had no server crashes so far. However, since the webserver does not support https out-of-the-box, I had to downgrade the whole blog to http to be able to embed apps in articles. Moreover, for really immersing a streamlit app into the blog, advanced customization is necessary. I.e. fonts and colors need to be adapted, CSS styles need to be supported. For professional use, user management and access control is a must as well as the ability to manage multiple apps using the same server.

What’s the gist

Streamlit is a very interesting new startup that builds powerful tools for rapid prototyping and visualization. It is specially tailored to data science and machine learning problems. Even in its very young, current iteration, it is extraordinarily stable and delivers beautiful, product-like web front ends.

If you any questions concerning setup or usage of streamlit, please let me know in the comments below. Please consider supporting me via my steady page (the blue floating button) to keep me working full time on this blog.