Examples:
Let's imagine you had done the analysis in this Deepnote project and you wanted to turn it into a dashboard.
We will do exactly that in the first half of today's class, then deploy it online in the second half. To get started:
...and so you finish creating a Streamlit dashboard before we get to the class break, then you should do the following things, in this order:
...don't worry! It's a very technical set of content for today. I suggest these ways to get help:
If needed, review the technique for this in this section of the course notes.
The final result should be that you can run your Python script in either of the following ways, and see the resulting plot.
python baseball-example.py
If needed, review the technique for this in this section of the course notes.
You know this is working if you can run streamlit run baseball-example.py
from the command line and view the result in your browser.
Recall that any changes you make to your Python script after that can be automatically updated in the browser if you click the "Always rerun" button when prompted.
If needed, review the technique for this in this section of the course notes.
This should not change the way that your dashboard behaves at all.
But in the end, your dashboard should begin with the declaration of a few constants, perhaps like these:
first_year
last_year
position
(But exactly which parameters you choose to factor out is up to you.)
If needed, review the technique for this in this section of the course notes.
When this is complete, each of the parameters you created in the previous step should have an input control visible on your dashboard.
If you chose the parameters I suggested in the previous slide, you might do something like this:
If needed, review the options for improvements listed in this section of the course notes.
In particular, ensure that:
If you finish the previous steps early, check out my version of this project online.
What do you notice that's different? Can you add those features to yours as well?
To help you figure out what to try, here's a list.
@st.cache
, as described in this section of the course notes.We'll take a break at this point.
The second half of class will consist entirely of deploying your app to Heroku. This can be challenging! I'll offer as much help as I can.
Follow the procedure outlined in the second half of today's course notes.
If you finish before class is done:
Recall that some part of your final project must be a dashboard running live on the web.
This has two consequences as you think ahead about that project: