Spaces:
Runtime error
Runtime error
File size: 374 Bytes
65d8c78 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | 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") |