App-solutely Fabulous: A Data Scientist’s Guide to Choosing Python Web Tools Wisely

Alan Feder

Who am I?

Alan Feder Headshot

  • Alan Feder
  • Staff LLM Data Scientist at Magnifi / TIFIN
  • Freelance Consultant
  • R Expat
  • LGM

Data Scientists in R love Shiny

  • I’m a Data Scientist – I don’t even know HTML, CSS, JavaScript, React
  • Am I stuck with copying and pasting my graphs to PowerPoint?

Python has many more options

Too many options

Try (some of) them!

  • Let’s try to make one app with three different methods

  • We’ve already had a lot of different RAG talks this conference - so see how to share your app

Server vs. Serverless

  • The computations need to happen somewhere - Python or R needs to be installed somewhere
    • You probably want to share your app with someone, and they need to be able to run it
  • If you see “localhost:8000”, then all the computations are happening locally - so sending the file won’t help unless they have all the data and packages
  • In-browser versions can often be a good option if you don’t have a ton of data
    • BE CAREFUL ABOUT YOUR PASSWORDS AND API KEYS

Streamlit

  • Launched in 2019
  • Purchased by Snowflake in 2022 for $800m
  • I’ve been using it a lot for the past 2 years - and even used in a (NY) R Conference talk!

Streamlit - 😃

  • Lots of elements to use
    • New ones all the time
  • Very Pythonic
    • Simple to transition from script

Streamlit - 🫤

  • Runs top to bottom - not at all reactive
    • Has caching, but it gets confusing very quickly
  • Can get very slow if it gets big
  • All Streamlit apps kinda look the same
    • Hard to tweak UI

Streamlit

Streamlit-Lite

  • Stlite

    • Not officially supported by Streamlit
  • Pretty easy interface to copy your Streamlit apps

  • I couldn’t figure out how to do streaming

  • Slower to load, slower to run

  • Link: In-Browser Streamlit

Gradio

  • Started by some Stanford PhD Students in 2019
  • Purchased by Hugging Face in December 2021
  • Powers most Huggingface Spaces

Gradio - 😃

  • Very focused on ML
  • Even simpler than Streamlit
  • Built in interfaces for Chat
  • Had reactive blocks

Gradio - 🫤

  • Less flexible than Streamlit
    • Complicated to do multiple things at once
  • All Gradio apps look the same – even more so than Streamlit
  • Fewer components available
    • Sometimes need to use HTML to do what you want