Article: Streamlit for Prototyping
by Harry Chang • 4 April 2024
by Harry Chang • 4 April 2024
Primarily used for data science and analytics, the Streamlit framework based in Python has seen a recent surge in its usage by product analysts, data scientists and even webpage enthusiasts alike. Harry shares more about its growing popularity, particularly as a baseline prototyping tool before building a full-stack product, as well as his personal experiences with it through his past hackathons.
Streamlit is a versatile Python library widely used in the fields of data science and analytics, akin to R's Shiny and Python's Plotly, Dash, or Flask. It stands out for its ability to swiftly create user-friendly dashboards for web applications. Beyond its primary application, Streamlit's adaptability makes it an excellent tool for hackathon participants seeking to rapidly prototype low-fidelity versions of full-stack web products, including those based on technologies like React and Next.js. An added benefit is its seamless integration with the OpenAI API, making it a popular choice for incorporating ChatGPT into web applications to test product concepts.
Streamlit is particularly suited for prototyping due to its unique blend of simplicity, flexibility, and rapid development capabilities. Here's how Streamlit facilitates the prototyping process:
Ease of Use: With a simple API, Streamlit allows developers to turn data scripts into shareable web apps with minimal code.
Interactive Widgets: Without the need for a callback, interactive widgets like sliders, buttons, and text inputs can be easily integrated.
Custom Components: Extend functionality with custom components, or integrate existing React components to create rich, interactive applications.
Hot-Reloading: Streamlit's development server automatically detects changes in the script and refreshes the app, making iterative development fast and responsive.
Seamless Data Integration: Connect easily to databases, cloud services, and APIs, including the OpenAI API for incorporating AI and machine learning models.
Streamlit's combination of ease of use, interactivity without complexity, real-time updates, ease of sharing, versatility, and the ability to incorporate custom components makes it an ideal tool for prototyping web applications. It allows teams to quickly move from idea to prototype, enabling fast iteration based on user feedback and significantly shortening the development cycle.
To learn more about Streamlit's suite of features, widgets and extensions, click here to find out more!
Basic introductory videos on Streamlit, its features and basic use cases (including your own personal website!)
Streamlit has carved a niche for itself as a preferred tool for data scientists and developers looking to deploy interactive data applications quickly. While it shines in ease of use and rapid prototyping, there are several alternatives worth considering, each with its own strengths.
Shiny: A web application framework for R, Shiny is highly favoured for statistical and analytical applications, offering deep integrations with R's extensive package ecosystem.
Plotly Dash: Dash is a Python framework for building analytical web applications. It is particularly known for its rich interactive visualisations, leveraging Plotly's powerful charting capabilities.
Flask: While not specifically designed for data applications, Flask is a lightweight Python web framework that offers flexibility and control, making it suitable for building custom web applications from scratch.
Voilà: For those working in the Jupyter ecosystem, Voilà can turn Jupyter notebooks into standalone web applications, bridging the gap between data analysis and web deployment.
Gradio: Emerging as a compelling choice for machine learning practitioners, Gradio simplifies the process of creating interactive GUIs for models. Its ease of use for building and sharing complex model interfaces—such as those requiring image, audio, or text inputs—makes it invaluable for quick demonstrations and feedback. Gradio's built-in functionality for sharing models via a link facilitates collaborative testing and iteration, emphasising its role in the rapid prototyping of AI and machine learning applications.
Each of these alternatives has its context where it might be the better choice, depending on the specific requirements of the project, such as the need for complex visualisations (Dash), deep statistical analysis (Shiny), or custom web functionality (Flask).
Streamlit's simplicity and efficiency make it suitable for a broad range of applications:
Data Visualization Dashboards: Quickly bring data to life with interactive charts and maps to share insights in an engaging way.
Machine Learning Model Demos: Showcase machine learning models interactively, allowing users to adjust parameters and see results in real time.
Data Wrangling Tools: Build tools to clean and transform data, making preprocessing steps more accessible and understandable.
Prototyping Web Applications: Rapidly prototype web apps to validate ideas or demonstrate concepts, especially useful in hackathons or startup MVPs.
Over the past year or two, I was fortunate to pick up this framework through my coursemates, and was blown away with the potential it had to offer. As one who used to participate actively in hackathons, it is enlightening to see that many of my peers utilise this on top of their school assignments as well, particularly given its ease of usage when working under time constraints. Listed below are some personal demonstrations of its usage:
In summary, Streamlit is a powerful tool for data scientists and developers looking to quickly build and deploy data-driven web applications. Its simplicity, combined with a wide range of features, makes it a versatile choice for various use cases, from visualization dashboards to machine learning demos. While alternatives like Shiny, Dash, and Flask offer their own unique advantages, Streamlit's focus on rapid development and ease of use sets it apart in the landscape of data application frameworks.
As part of his summer plans, Harry will be collaborating with his former club - NUS Statistics and Data Science Society - once again to organise another technical workshop, focusing on the practicality of Streamlit in the world of data science and analytics. If you enjoyed the content of this article, do keep a look out for this workshop! UPDATE: sign-ups now open! bit.ly/nussds-streamlit
Formerly the President of NUS Statistics and Data Science Society (NUS SDS) and NUS Product Club, Harry has re-established his commitment to our Publicity Team, focusing primarily on managing our club's website, as well as the potential renewal of our "Lorong Product" podcast moving forward.