My first app with Streamlit 🎈

Hayriye Anıl
3 min readMar 1, 2024

--

Designed by me in Canva

Hi there! How can we present our works in a more interactive, faster and understandable way and show them to the world?

As data scientists, we can conduct countless data analyzes in the projects we work on, develop prediction models, and discuss the performance results of these models with our stakeholders many times. At the end of these meetings, there may be other analyzes to be done or other ways to be tried, and of course, more results may emerge to show. This cycle continues like this.

No matter how much analysis we do or develop machine learning models, none of it means anything if we can’t present our results in a way that our stakeholders and colleagues can see and understand.

Presenting our work in an understandable, readable and fast manner is an indispensable part of our job.

This is where Streamlit comes into play.

Streamlit is a tool and Python library that helps create and develop fast and impressive web applications. Streamlit can display analysis results with powerful and interactive Python graphics, manipulate graphs and tables with input from the user, and automate repetitive analysis tasks. It is a web application tool that is easy to use and deploy and ready to share in minutes.

I studied Streamlit from a book called Streamlit for Data Science written by Tyler Richards. With what I learned from this book, I created my first Streamlit application and I am ready to share it with you!

As someone who uses metro or Marmaray more than buses in Istanbul, I wondered which stations were more crowded, which age group used these stations, or which stations were busiest on public holidays. Based on this curiosity, I prepared the Istanbul Rail System Analysis App — Rail Systems Station Based Passenger and Journey Numbers by Age Group — with the dataset I downloaded from IMM’s Open Data Portal.

In this app, you can see the locations of the stations on the map of the rail line you have chosen, view the number of passengers or journeys per station by selected month, public holiday, age group or month and week, or examine which age group uses that rail system.

Screenshot from app

I used Plotly for visualization, but Streamlit also supports libraries such as Seaborn, Matplotlib, Bokeh, Altair, PyDeck along with Plotly.

Screenshot from app

You can upload a data file to your application, download a dataset from the application, and edit the existing dataset.

Screenshot from app

I chose Streamlit Community Cloud, which is the most preferred, easy to use and free.

Streamlit Community Cloud works with GitHub and uses its own servers to host the application. To deploy your application here, you must keep your application in the public repository on GitHub and include in requirements.txt which Python libraries you use for the application to run.

Designed by me in yEd Editor

By default, Streamlit Community Cloud works with public code, dataset and model. If you want to keep some information in your application confidential or set up an application that only some people can access, you can create a secret and private password with Streamlit Secrets.

You can access the Istanbul Rail System App here. Link and codes are public. Check it out!

https://istanbulrailsystem.streamlit.app/

REFERENCES

Tyler Richards — Streamlit for Data Science (2nd Edition)

--

--