What is Streamlit? Build A Travel Booking Insights App With Streamlit In 30 Mins

Introduction

I played around with streamlit to build a Travel Booking Insight app in no time. I started with zero understanding of streamlit. In about 1 hour of exploration, I could build and deploy a basic app in streamlit using the streamlit community cloud. I have managed to build a preliminary, but not absolute picture of what Streamlit has to offer.

Background

Streamlit popped onto my radar a few weeks back and I thought of digging around to find out why it’s picking up popularity.

Having read the book “Show Your Work” recently, I thought I’d document my process and blog about it. Thus here I am writing about my journey to understand what Streamlit is all about.

What is Streamlit? and Why is it popular?

My process is to research the web by reading the brand web page for the tool, opinions on Reddit, blogs on medium, seeing Github examples, and finally playing around with the tool by writing actual working code and building a simple toy apps.

Here are some of my questions answered for streamlit after an intense (not exactly) research:

  1. Is the website looking cool? https://streamlit.io/ (silent respect) 
  2. What is it?: Streamlit is an open-source Python library that allows users to create web applications for data analysis and machine learning projects. It enables you to build interactive and customizable web interfaces directly from Python scripts.
  3. What problem does it solve?: Streamlit simplifies the process of deploying machine learning models and data visualizations into web applications. It eliminates the need for web development skills and enables data scientists and ML engineers to quickly share their work with others.
  4. What are the alternatives to Streamlit (find similar tool): Some alternatives to Streamlit include Gradio, Dash, Shiny (for R users), Voila, and Panel.
  5. How does it compare, contrast to, or build upon the other solution I am familiar with?: Streamlit differentiates itself by offering simplicity and ease of use. Its syntax is very straightforward, and it aims to minimize boilerplate code, making it faster to iterate and deploy applications compared to some alternatives.
  6. Is there a buzz around it? and why?: There’s been lot of buzz around Streamlit due to its simplicity, rapid development cycle, and its ability to democratize web application development for data scientists and ML practitioners.
  7. Does it cater to a niche or is it a wider and more generic solution?: While initially targeted towards data scientists and ML engineers, Streamlit has gained popularity across a wider audience due to its ease of use and versatility.
  8. How does it integrate into the rest of the ecosystem?: Streamlit integrates seamlessly with popular Python libraries such as Pandas, Matplotlib, and Plotly, allowing users to leverage their existing knowledge and workflows.
  9. What are the commercials and pricing models?: Streamlit is open-source and free to use. However, they also offer Streamlit for Teams, which provides additional collaboration and deployment features for organizations, with pricing based on usage. Streamlit also offers a cloud offering.
  10. Is there a community of users?: Yes, Streamlit has a growing community of users who actively contribute to its development, share examples and best practices, and provide support through forums and other channels.
  11. Ease of use: Streamlit has built really convenient integration of streamlit cloud with github to let a user get up and running with streamlit app really fast. As you read on, you’ll see

Streamlit vs Competitor Feature Comparison

FeatureStreamlitGradioDashShinyVoilaPanel
LanguagePythonPythonPythonRPythonPython
Ease of UseExtremely easy with minimal boilerplate codeVery easy with intuitive UIRequires more setup and code compared to StreamlitUser-friendly but may require more code than StreamlitRelatively easy with Jupyter notebook-like experienceRequires more code compared to Streamlit
DeploymentDeployable as a standalone web app or via Streamlit sharingDeployable as a web app, REST API, or in ColabCan be deployed as standalone apps or on Dash EnterpriseRequires a Shiny server for deploymentStandalone deployment or integrated into Jupyter NotebooksCan be deployed as standalone apps or in a dashboard server
CustomizationLimited customization options but focused on simplicityCustomizable with pre-built components and callbacksHighly customizable with Dash componentsCustomizable with HTML, CSS, and RLimited customization compared to DashProvides a variety of customization options
Development SpeedRapid development cycle due to simple syntaxFast development cycle with drag-and-drop interfaceRequires more setup and development time than StreamlitSimilar development speed to Streamlit but with R languageFast development with Jupyter notebook integrationDevelopment speed may vary based on complexity
Learning CurveVery low learning curveVery low learning curveModerate learning curveModerate learning curve for R usersModerate learning curveModerate learning curve
Community SupportGrowing community with active support forumsGrowing community with active support forumsLarge community with extensive documentationLarge community within R communityGrowing community with active support forumsGrowing community with active support forums
Commercial OptionsStreamlit for Teams for additional collaboration featuresGradio Pro for additional features and supportDash Enterprise for enhanced deployment and supportShiny Server Pro for scalability and securityN/APanel Enterprise for additional features and support
Integration with EcosystemSeamless integration with Python data science librariesIntegrates well with Python libraries and modelsWorks well with Python libraries and Plotly chartsIntegrated with R ecosystem and packagesIntegrates well with Jupyter ecosystemIntegrates well with Python data science ecosystem

Building a Travel Booking Insight App with Streamlit

You can find my code published at

https://github.com/prasaadk/streamlit-travel-booking-insights

Data

I created a CSV file where each row represents a travel booking, with columns for the region, country, and booking value.

travel-booking-data.csv

Streamlit Demo Code

pages/0_Travel_Booking_Insights.py

Output

Live demo available at: https://travel-booking-insight.streamlit.app/

Streamlit Community Cloud + Github Codespaces

It was “smooth like butter” to deploy the code with Streamlit Community Cloud and the Github Codespace integration. You could build, test, edit, and launch an app in no time.

Streamlit Connectors

In Data Engineering, the power of any data tool comes from the number of connectors it supports. I was glad to see some good documentation and support for S3, Snowflake, BigQuery, some RDBMSes.

Conclusion

I found it easy to build the app I had in my mind. I went from a concept to reality in under 30 minutes. However, this was a simple application where the data was present in the same repository. The real world of data engineering is much more complex. The real test of the app is when you start dealing with data connection, networking,  refreshes, and data of terabyte/Petabyte scale volumes.

I am far from evaluating Streamlit for real-world scenarios.

I am yet to be convinced that this is the next big thing in Data Engineering or the Data Visualisation Prototyping world. No doubt it’s simple with an easy learning curve. It is certainly climbing up on its hype curve, and from what I have seen, it’s a tool well-engineered with sufficient attention to user experience and convenience. I’d say be careful with adopting what’s trending. It’s tricky I know. I suffer from the “Shiny New Thing” syndrome as well.

ChatGPT Disclaimer: I have used ChatGPT in some sections to increase my efficiency, correct my grammar, and embellish my writing. 

Leave a Reply

Your email address will not be published. Required fields are marked *