-
Notifications
You must be signed in to change notification settings - Fork 0
Home
This is the front-end part of a generic boilerplate for basic ML/DL projects. It has the basic functionality for doing one-off predictions based on simple inputs (i.e. not on images for example, or large numbers of inputs).
It contains nothing more than all the configuration files for the project. No actual code.
- Streamlit for the front end
Hit the green Use this template
button at the top of the template repo, or follow this link, to create a new repository.
Once created, clone your new repo to your (and your teammates') machines with the green <> Code
button and your favourite method (probably GitHub CLI).
-
app.py
: main streamlit page -
pages/
: put a .py file per page here if you use multiple pages -
media/
: store visual elements for your pages here -
.streamlit/
: configuration files for streamlit
Complete the following files (if needed):
requirements.txt
-
.streamlit/config.toml
: mainly for layout purposes -
.streamlit/secrets.toml
: base it on the sample file; reflect the contents also in the Secrets settings on Streamlit Cloud
Create a new virtual environment (different from the one for your backend, and install all packages:
pyenv virtualenv 3.10.6 <your-project-name>-front
pyenv local <your-project-name>-front
pip install -r requirements.txt
When finished, run make test_structure
, and check any errors or warnings.
All commands to run streamlit connecting to a local API or to an API running on GCP have been included in the Makefiles:
-
make streamlit
: defaults tomake streamlit_local
-
make streamlit_local
: run streamlit locally and connect to local API (running through uvicorn on port 8000) -
make streamlit_local_docker
: run streamlit locally and connect to local Docker container (running on port 8080) -
make streamlit_cloud
: run streamlit locally and connect to cloud API
Just type make <tab>
on the command line to list all possibilities
URIs for local and cloud APIs are included in the .streamlit/secrets.toml
file (or in the Secrets setting on Streamlit Cloud)