Spaces:
Runtime error
Runtime error
Download frontend/secrets.py from adwhytahumans/CRM_FastAPI_React: direct link, hf CLI and curl.
- Browser
- Download file 462 Bytes
-
https://huggingface.co/spaces/adwhytahumans/CRM_FastAPI_React/resolve/main/frontend/secrets.py
- Command line
-
hf download hf://spaces/adwhytahumans/CRM_FastAPI_React/frontend/secrets.py
-
curl -L -o secrets.py https://huggingface.co/spaces/adwhytahumans/CRM_FastAPI_React/resolve/main/frontend/secrets.py
462 Bytes
| import os | |
| from huggingface_hub import HfApi | |
| def get_secret(): | |
| # Try to get from environment variable first (for local development) | |
| api_key = os.getenv("GROQ_API_KEY") | |
| # If not found, try to get from Hugging Face secrets | |
| if not api_key: | |
| try: | |
| api_key = HfApi().get_space_variable("GROQ_API_KEY") | |
| except Exception as e: | |
| print(f"Error getting secret: {e}") | |
| return None | |
| return api_key |