MLOps with Streamlit

I’d like to know if you can recommend any best practices (tips, do’s & don’ts) when using Streamlit for MLOps purposes?
I’m compiling some material to teach my students.

1 Like

This depends on how extensive the “ML part” of the project is. However, from my experience the following helps in most projects:

  1. Inculcating a habit of creating docker images appropriately (for some projects one might need to use a different python image or nvidia gcc image)

  2. Using dockerignore to avoid notebooks,logs,etc on the image

  3. Setting up a mkdocs branch (or Sphinx if one wishes to spend more time) for the streamlit application especially if it has multiple functionalities on multiple pages and has different util files comprising tens or maybe hundreds of methods/functions for data processing/prediction, etc saves a lot of time for the developer/team to maintain the code and return to add/remove features

  4. Managing secrets appropriately

  5. Setting up GitHub Actions for code quality checks

  6. DVC for any input data used in the streamlit app for analysis

  7. Pre-Commit for better code checking + unit test enforcement (of individual functions at times)