DEV Community

Cover image for 4 Streamlit Alternatives for Building Python Data Apps
Brooke Myers for Anvil

Posted on • Originally published at anvil.works

4 Streamlit Alternatives for Building Python Data Apps

Streamlit is a library for turning Python scripts into shareable web applications. Streamlit apps are designed for the data science and machine learning community and make it easy to build dashboards and interactive ML models. What makes Streamlit so popular is its simplicity. Using the Streamlit library is quick and intuitive, which means you can create data apps without needing any web development experience.

An example Streamlit application showing data on New York City Uber pickups

While Streamlit is a great tool, it can fall short depending on your use case. The layout and styling of Streamlit apps is pretty rigid, so unless you're willing to write some HTML, JS and CSS, all your apps will pretty much look the same. Streamlit also has speed issues becuase it reruns the Python script serving the app after every interaction on the frontend.

While Streamlit claims "instant deployment", this isn't quite true. Although deploying an app on Streamlit Cloud isn't difficult, it takes several minutes each time you deploy a new change -- and that's not counting the time it takes the first time to connect up GitHub and Streamlit Cloud.

If you're looking for an alternative to Streamlit, you have some options. In this article, we’ll be taking a look at four different alternatives:

  1. Gradio: a Python library for building machine learning demos
  2. Plotly Dash: a low-code framework for building data apps with the Plotly plotting library in Python, R or Julia
  3. Panel: a Python library for creating flexible dashboards and web apps
  4. Anvil: a platform for building full-stack web apps in Python

TL;DR

Don't have the time? Skip the details of each alternative, and go straight to the summary.

1. Gradio

Gradio is probably the most similar alternative to Streamlit on this list. Like Streamlit, Gradio is a Python library for turning datasets and machine learning models into interactive web UIs. The main difference is that Gradio is designed more for machine learning demos whereas Streamlit is designed for creating data dashboards.

Image description


An example Gradio application. Find it here.

Pros:

  • East to use ML Models: Gradio is now part of Hugging Face, and the Hugging Face integration makes it sleek and simple to load ML models and datasets.
  • Easy to share your apps: It's easy to share your apps. You can quickly generate a link to send to other users, but this link expires after 72 hours and runs all the code on your own machine. To share your app, you'll need to host it someplace else, like Hugging Face Spaces.
  • Embed in notebooks: Gradio can be embedded in a Python notebook. This makes it easy to share and interact with code.

Cons:

  • Dated appearance: Gradio apps have a very basic and dated look. It is possible to customize them, but you'll need to know how to write some CSS
  • Out-of-the-box cloud hosting options are limited: The simplest way to host your Gradio app is on Hugging Face Spaces, but apps hosted on Spaces are very clearly hosted within the Hugging Face website, which makes it hard to brand your app for yourself or your company.
  • Not standalone apps: Gradio apps work best when embedded in another webpage, unlike Streamlit apps which work well as standalone apps.

2. Plotly Dash

Plotly is a plotting library, and Dash is their open-source framework for building data apps with Python, R or Julia. (Dash also has an Enterprise version, but we'll focus on the open-source library here.)

Screenshot of a Plotly Dash app showing data on NYC Uber pickups


An example Dash Enterprise application. Find it here.

Pros:

  • Faster than Streamlit: Dash only needs to run the functions that are called while interacting with the app. With Streamlit, the entire script is re-run with every interaction.
  • Work in Jupyter notebooks: If you prefer working in a Jupyter notebook, the jupyter-dash library lets you run your dashboards within a Jupyter notebook.
  • More flexible design: If you know some HTML and CSS, you can more easily style your Dash apps how you want.
  • Not limited to Python: Dash is also a framework for R and Julia, so you are not limited to building apps in Python.

Cons:

  • Limited layout options without HTML: Dash has a Python wrapper around HTML for building UIs, but you still need an understanding of HTML in order to use it.
  • Larger learning curve: Dash is a bit more complicated than Streamlit (you'll need to use "callbacks" and some HTML, for example), so it isn't as easy to get started with.
  • Mostly Limited to Plotly: Dash is a Plotly product, so the framework is designed to work with that plotting library. Technically, you can use Dash with other plotting libraries but not as easily and smoothly as Plotly.

3. Panel

Like the previous three alternatives, Panel is an open-source Python library for creating interactive dashboard web apps. Panel is extremely flexible, allowing you to use any plotting library you like. Like Gradio but unlike Streamlit, you can use Panel in Jupyter notebooks. Panel dashboards can also be deployed as standalone web apps, but like Plotly Dash, you'll need to set up a server to deploy it yourself.

Screenshot of a Panel app showing data on NYC taxi rides


An example Panel application. Find it here.

Pros:

  • Work in Jupyter notebooks: Panel integrates well with Jupyter notebooks, if that's how you prefer to write code.
  • Faster UI: Unlike Streamlit, Panel does not re-run the entire Python script with every interaction, which means the UI can update much faster.
  • Use any plotting library: Panel is also not tied to any specific plotting library (but Streamlit includes integrations with all of the most popular Python plotting libraries).
  • Start with a template: Panel has some templates to start with. Although they are not very modern, they make it easier to vary the look of apps than Streamlit does.

Cons:

  • Dated appearance: By default, Panel apps look extremely boring and dated even when using a template. Changing the styling of Panel apps requires writing CSS.
  • Larger learning curve: Panel is not as simple and intuitive as Streamlit is when building more complex apps.
  • Small community: Panel has a smaller community, which means it can be harder to discuss and get help with using the library.
  • No out-of-the-box cloud hosting option: Like all of the options here, Panel makes it easy to run and host your apps locally, but if you want to deploy them to the cloud, you're on your own. They do provide a guide on different deployment options.

4. Anvil

Anvil is not a Python library like the other alternatives, but an entire IDE for building and deploying full-stack Python web applications. Anvil has a drag-and-drop page designer, which makes it much easier to layout and style the UI of your apps than any other alternative on the list. Because Anvil is more than just a Python library, it has more bells and whistles than the other options, such as a built-in database, user authentication, version control and cloud hosting that takes a matter of seconds to set up. All of this also means that it can have a bit more of a learning curve than the other alternatives.

Screenshot of an Anvil app showing data on NYC Uber rides


An example Anvil application. Find it here.

Pros:

  • Deploy apps to the cloud instantly: Anvil has truly instant cloud deployment. After just two clicks and no waiting time, your app is deployed. Basic hosting is free, including private apps. On paid plans, you can also have multiple development environments and add your own custom domains.
  • Design the layout: The drag-and-drop UI designer makes it easier to layout and style unique dashboards without CSS and HTML (although you can use them if you want).
  • Connect to a built-in database: The built-in database means you can store, query and edit data all with Python. Anvil also has file storage for connecting CSV datasets, ML models and other large files.
  • Plotly is built in: The built-in Plotly integration makes it easy to build dashboards.

Cons:

  • Larger learning curve: Anvil has more of a learning curve than the other alternatives, which are just Python libraries.
  • Some features require a paid plan: The Plotly integration is available for free, but if you want to install other Python libraries such as Pandas or Matplotlib, you'll need a paid plan (starting at $15/mo, with a free trial).

Summary

  • Streamlit
    • Strengths: Quick to learn, easy for simple internal-facing or personal projects
    • Weakness: Can be slow to run and deploy, limited in features and flexibility
  • Gradio
    • Strengths: Easily connect to HuggingFace packages
    • Weaknesses: Doesn't work well as a standalone app, limited in features and flexibility, basic and dated appearance
  • Plotly Dash
    • Strengths: Apps are fast, work from a Jupyter notebook, can use R or Julia
    • Weaknesses: Larger learning curve, need to know some HTML to layout apps
  • Panel
    • Strengths: Use any plotting or visualisation library no matter how niche, work from a Jupyter notebook
    • Weaknesses: Basic and dated appearance, larger learning curve, no out-of-the-box cloud hosting
  • Anvil
    • Strengths: Out-of-the-box instant cloud hosting , drag-and-drop UI builder, more features for complex apps
    • Weaknesses: Larger learning curve, not all features are available for free

Conclusion

Streamlit is a great tool for turning a Python script into an interactive web application. But it's not your only option for building Python data apps. Gradio is a good tool for ML-focused apps, especially if you want to embed them in a Jupyter Notebook. For building dashboards, Plotly Dash gives you more flexibility over the layout of your app, while Panel is the best option for using more niche plotting libraries. But if you're looking to build more complex apps and want to have control over their layout and design, then Anvil comes out on top.

Oldest comments (0)