Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -12,22 +12,12 @@ try:
|
|
| 12 |
except ImportError:
|
| 13 |
Groq = None
|
| 14 |
|
| 15 |
-
# Read the API key from Hugging Face Secrets
|
| 16 |
-
GROQ_API_KEY = os.environ.get("GROQ_API_KEY")
|
| 17 |
-
|
| 18 |
-
# Safety check – show status in the app (never show actual key!)
|
| 19 |
-
if GROQ_API_KEY:
|
| 20 |
-
st.sidebar.success("✅ GROQ API Key found")
|
| 21 |
-
else:
|
| 22 |
-
st.sidebar.error("❌ GROQ API Key missing! Please set it in Hugging Face Spaces -> Settings -> Repository Secrets")
|
| 23 |
-
|
| 24 |
-
|
| 25 |
# -----------------------------
|
| 26 |
# Utility Functions
|
| 27 |
# -----------------------------
|
| 28 |
def load_api_key() -> str:
|
| 29 |
"""Load the GROQ API key from Hugging Face secrets or env vars."""
|
| 30 |
-
api_key = os.
|
| 31 |
if not api_key:
|
| 32 |
try:
|
| 33 |
from huggingface_hub import HfFolder
|
|
|
|
| 12 |
except ImportError:
|
| 13 |
Groq = None
|
| 14 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
# -----------------------------
|
| 16 |
# Utility Functions
|
| 17 |
# -----------------------------
|
| 18 |
def load_api_key() -> str:
|
| 19 |
"""Load the GROQ API key from Hugging Face secrets or env vars."""
|
| 20 |
+
api_key = os.environ.get("GROQ_API_KEY")
|
| 21 |
if not api_key:
|
| 22 |
try:
|
| 23 |
from huggingface_hub import HfFolder
|