Spaces:
Sleeping
Sleeping
Update agent.py
Browse files
agent.py
CHANGED
|
@@ -27,6 +27,17 @@ if hf_token:
|
|
| 27 |
print(f"✅ Environment variable found. (Length: {len(hf_token)})")
|
| 28 |
else:
|
| 29 |
print("❌ Environment variable 'TokenApertus' (or 'Token_Apertus') NOT found.")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30 |
|
| 31 |
# Initialize Client safely
|
| 32 |
client = None
|
|
|
|
| 27 |
print(f"✅ Environment variable found. (Length: {len(hf_token)})")
|
| 28 |
else:
|
| 29 |
print("❌ Environment variable 'TokenApertus' (or 'Token_Apertus') NOT found.")
|
| 30 |
+
|
| 31 |
+
# DEBUG AID: Check if there's a typo in the variable name
|
| 32 |
+
# This will print any available environment variables that contain "TOKEN" or "APERTUS"
|
| 33 |
+
# so you can see if you named it slightly differently (e.g. all caps).
|
| 34 |
+
candidates = [k for k in os.environ.keys() if "TOKEN" in k.upper() or "APERTUS" in k.upper()]
|
| 35 |
+
if candidates:
|
| 36 |
+
print(f" ⚠️ Found these similar variables: {candidates}")
|
| 37 |
+
print(" Please update the code to match the exact name used in Settings.")
|
| 38 |
+
else:
|
| 39 |
+
print(" ⚠️ No variables containing 'TOKEN' or 'APERTUS' were found.")
|
| 40 |
+
print(" Ensure you created a 'Secret' (not a Variable) in HF Space Settings and performed a Factory Reboot.")
|
| 41 |
|
| 42 |
# Initialize Client safely
|
| 43 |
client = None
|