Update with token.
Browse files
app.py
CHANGED
|
@@ -4,9 +4,20 @@ import os
|
|
| 4 |
"""
|
| 5 |
For more information on `huggingface_hub` Inference API support, please check the docs: https://huggingface.co/docs/huggingface_hub/v0.22.2/en/guides/inference
|
| 6 |
"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
client = InferenceClient(
|
| 8 |
provider="groq",
|
| 9 |
-
api_key=
|
| 10 |
)
|
| 11 |
|
| 12 |
def respond(
|
|
|
|
| 4 |
"""
|
| 5 |
For more information on `huggingface_hub` Inference API support, please check the docs: https://huggingface.co/docs/huggingface_hub/v0.22.2/en/guides/inference
|
| 6 |
"""
|
| 7 |
+
|
| 8 |
+
hf_token = os.getenv("HF_TOKEN")
|
| 9 |
+
|
| 10 |
+
# Add this to your app's UI for debugging
|
| 11 |
+
if hf_token:
|
| 12 |
+
st.success("✅ HF_TOKEN was found!")
|
| 13 |
+
# Optional: Display the first few characters to confirm it's not empty
|
| 14 |
+
# st.write(f"Token starts with: {hf_token[:4]}...")
|
| 15 |
+
else:
|
| 16 |
+
st.error("❌ HF_TOKEN not found in environment variables!")
|
| 17 |
+
|
| 18 |
client = InferenceClient(
|
| 19 |
provider="groq",
|
| 20 |
+
api_key=hf_token,
|
| 21 |
)
|
| 22 |
|
| 23 |
def respond(
|