From f462e02c0cc7459595df5d8a95cd17797aaf04ea Mon Sep 17 00:00:00 2001 From: fnery Date: Thu, 16 May 2024 08:55:21 +0100 Subject: [PATCH] Revert "Try to remove the need for .streamlit/secrets.toml" --- visualize/streamlit_app.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/visualize/streamlit_app.py b/visualize/streamlit_app.py index 0fdd2e9..8705491 100644 --- a/visualize/streamlit_app.py +++ b/visualize/streamlit_app.py @@ -1,4 +1,3 @@ -import os import streamlit as st from google.oauth2 import service_account from google.cloud import bigquery @@ -7,8 +6,11 @@ from PIL import Image -os.environ["GOOGLE_APPLICATION_CREDENTIALS"] = './GCLOUD_SERVICE_ACCOUNT_KEY_FILE.json' -client = bigquery.Client() +# Authentication and BigQuery client setup +credentials = service_account.Credentials.from_service_account_info( + st.secrets["gcp_service_account"] +) +client = bigquery.Client(credentials=credentials) # Cache data loading function @st.cache_data(ttl=600)