This is prerequisite to the database setup using the app
[1]. Conda is already installed on the local machine.
[2]. Docker desptop is already installed on the local machine.
CONDA_SUBDIR=osx-64 conda create -n detectanomaly python=3.8 numpy pandas --override-channels -c https://repo.anaconda.com/pkgs/snowflake -y
conda activate detectanomaly
conda config --env --set subdir osx-64
pip3 install -r requirements.txt
If you are trying to test the streamlit app locally then you need to add credentials as environmental variables.
export SNOWFLAKE_ACCOUNT='<>';
export SNOWFLAKE_ROLE='<>';
export SNOWFLAKE_USER='<>';
export SNOWFLAKE_PASSWORD='<>';
export SNOWFLAKE_DATABASE='<>';
export SNOWFLAKE_SCHEMA='<>';
export SNOWFLAKE_WAREHOUSE='<>';
- Execute /src/sql/1_data_gen_n_model_training.sql
- Execute /src/sql/2_data_gen_for_inference.sql
- Execute /src/python/3_execute_inference.py
If the docker container is running hop on to the url http://localhost:8051
If you are testing the app locally then
streamlit run src/streamlit/app-home.py
docker build --rm --platform linux/amd64 -t <app_name> -f src/docker/Dockerfile .
cd src/docker
docker-compose --env-file .env up
Check the app in action localhost:8051
Execute /src/sql/3_create_spcs_app.sql
SHOW IMAGE REPOSITORIES;
SELECT "repository_url" FROM table(result_scan(last_query_id()));
docker tag <app_name> <repository_url>/<app_name>:v1
docker login <snowflake_registry_hostname> -u <user_name>
docker push <repository_url>/<app_name>:v1
Execute /src/sql/3_create_spcs_app.sql
Use the URL which is an outout of the following sql command
SHOW ENDPOINTS IN SERVICE streamlit_spcs;
Execute /src/sql/4_environment_cleanup.sql