Published 1st February 2022
Streamlit is an open-source app framework for machine learning and data science projects in Python which allows users to create a web application with a pure Python script. Users can create an interactive web app without spending much time on app development. With Streamlit, creating a dashboard for a machine learning solution has been made incredibly easy.
In this guide, we will show you how to deploy the Streamlit Uber demo on Northflank.
We started by cloning Streamlit’s Uber demo repo.
In order to deploy the demo on Northflank we had to add some required files.
- For deployment using a Dockerfile:
Dockerfile
. - For deployment using Buildpack:
Procfile
andsetup.sh
The repo can be found here and it has the following structure:
streamlit/
├─ Dockerfile (needed for Dockerfile deployment)
├─ Procfile (needed for Buildpack deployment)
├─ streamlit_app.py
├─ requirements.txt
└─ setup.sh (needed for Buildpack deployment)
Open the repository containing the Streamlit Uber demo. Click on
Use this template
to create a copy of this repository under your GitHub account.Connect your GitHub to your Northflank account. You can find details on how to do so in our documentation.
In your project, create a combined service. Under Repository, you will see a list of your repositories from which you can choose the Streamlit repo we just created. Select the branch
main
andDockerfile
as the build option.For service resources, we recommend at least nf-compute-50 (0.5 vCPU and 1024 MB memory) but you may choose a higher plan for increased performance (lower plans may not be enough for Streamlit to start properly).
A combined service handles build and deployment of your code.
Port 8080 will automatically be exposed with the HTTP protocol.
Access the deployment via the unique
code.run
service URL or finish up by linking a custom domain. You will see the example application with a straightforward slider.
Open the repository containing the Streamlit Uber demo. Click on
Use this template
to create a copy of this repository under your Github account.Connect your Github account to your Northflank account. You can find details on how to do so in our documentation here.
Create a combined service. As source, choose the Streamlit repository you created. Select the branch main and Buildpack as the build option.
For service resources, we recommend at least nf-compute-50 (0.5 vCPU and 1024 MB memory) but you may choose a higher plan for increased performance (lower plans may not be enough for Streamlit to start properly).
Access the deployment via the unique
code.run
service URL or finish up by linking a custom domain.
The Uber demo application examines how Uber pickups vary over time in New York City's and at its major regional airports. If you want to make changes to the application, you can edit the app.py
file. Check out the Streamlit docs for components and other advanced features you can add to your application.
Northflank allows you to deploy your code and databases within minutes. Sign up for a Northflank account and create a free project to get started.
- Connect with your preferred VCS: GitHub, GitLab or Bitbucket
- Manage build arguments and environment variables using secret groups
- Scale vertically and horizontally with multiple replicas per service
- Observe & monitor with real-time metrics & logs
- Create pipelines and release workflow as you grow
Related articles