Streamlit’s open-source app framework is the easiest way for data scientists and machine learning engineers to create beautiful, performant apps in only a few hours! All in pure Python. All for free.
But, if you want to deploy it online, how can we achieve it?
Just follow the steps below to get your first Streamlit APP online.
Suppose that you have finished your awesome Streamlit APP, you still need to create 4 files in your project folder.
(runtime.txt, setup.sh, Procfile, requirements.txt)
# To let heroku to know which programming language should usepython-3.7.6
# To do some automation task so that stremlit can work correctly on heroku
# please replace email@example.com with your own emailmkdir -p ~/.streamlit/
email = \"firstname.lastname@example.org\"\n\
" > ~/.streamlit/credentials.toml
headless = true\n\
port = $PORT\n\
" > ~/.streamlit/config.toml
# let heroku know which command to execute to run streamlit app
web: sh setup.sh && streamlit run app.py
# add the python package you will use inside your project
# for me, it would be:matplotlib==3.2.1
Step2. Work with Heroku CLI and git
We have to set up Heroku environment before pushing our app to the cloud, please make sure that you have installed the Heroku CLI correctly
$ cd path/to/streamlit_project
$ heroku login
$ git init
$ heroku create
$ git add .
$ git commit -m "Enter your message here"
$ git push heroku master
$ heroku ps:scale web=1
$ heroku open