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