Update app.py
Browse filesAdded changes to read gss_credentials from the Hugging Face secrets environment
app.py
CHANGED
|
@@ -41,8 +41,15 @@ def gs_client_from_secrets():
|
|
| 41 |
if not GS_AVAILABLE:
|
| 42 |
return None
|
| 43 |
|
| 44 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 45 |
if not creds_str:
|
|
|
|
| 46 |
return None
|
| 47 |
|
| 48 |
try:
|
|
|
|
| 41 |
if not GS_AVAILABLE:
|
| 42 |
return None
|
| 43 |
|
| 44 |
+
# Try reading from Hugging Face environment variable first
|
| 45 |
+
creds_str = os.environ.get("gss_credentials", "")
|
| 46 |
+
|
| 47 |
+
if not creds_str:
|
| 48 |
+
# Fallback to Streamlit Cloud secrets
|
| 49 |
+
creds_str = st.secrets.get("gss_credentials", "").strip()
|
| 50 |
+
|
| 51 |
if not creds_str:
|
| 52 |
+
logging.error("No Google Sheets credentials found.")
|
| 53 |
return None
|
| 54 |
|
| 55 |
try:
|