Spaces:
Sleeping
Sleeping
Download backend/credentials.py from tabiwellbeing/AI_Agent_Server: direct link, hf CLI and curl.
- Browser
- Download file 589 Bytes
-
https://huggingface.co/spaces/tabiwellbeing/AI_Agent_Server/resolve/main/backend/credentials.py
- Command line
-
hf download hf://spaces/tabiwellbeing/AI_Agent_Server/backend/credentials.py
-
curl -L -o credentials.py https://huggingface.co/spaces/tabiwellbeing/AI_Agent_Server/resolve/main/backend/credentials.py
589 Bytes
| import json | |
| import tempfile | |
| import os | |
| def setup_google_credentials(): | |
| creds_json = os.getenv("GOOGLE_APPLICATION_CREDENTIALS_JSON") | |
| if creds_json: | |
| # Create temporary JSON file from environment variable | |
| tmp_path = tempfile.NamedTemporaryFile(delete=False, suffix=".json").name | |
| with open(tmp_path, "w") as f: | |
| f.write(creds_json) | |
| os.environ["GOOGLE_APPLICATION_CREDENTIALS"] = tmp_path | |
| print("[CREDENTIALS] Using Google Cloud credentials from environment") | |
| else: | |
| print("[CREDENTIALS] Using local service account file") | |