Spaces:
Sleeping
Sleeping
uru commited on
Commit ·
eb04e0a
1
Parent(s): 5d62e8c
fix-paths
Browse files- .env.example +19 -1
- app.py +7 -0
.env.example
CHANGED
|
@@ -1 +1,19 @@
|
|
| 1 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# ================================
|
| 2 |
+
# Hugging Face API configuration
|
| 3 |
+
# ================================
|
| 4 |
+
|
| 5 |
+
# HF_TOKEN — your personal Hugging Face token.
|
| 6 |
+
# Used to access models via the HfApiModel / Inference API.
|
| 7 |
+
#
|
| 8 |
+
# How to get:
|
| 9 |
+
# 1. Go to https://huggingface.co/settings/tokens
|
| 10 |
+
# 2. Click "New token"
|
| 11 |
+
# 3. Select type: "Read"
|
| 12 |
+
# 4. Copy the token and paste it into .env
|
| 13 |
+
#
|
| 14 |
+
# IMPORTANT:
|
| 15 |
+
# - Never commit .env to the repository
|
| 16 |
+
# - Use .env only locally
|
| 17 |
+
# - In Hugging Face Spaces, set the token in Settings → Secrets
|
| 18 |
+
|
| 19 |
+
HF_TOKEN=hf_your_token_here
|
app.py
CHANGED
|
@@ -12,6 +12,13 @@ from tools.web_search import DuckDuckGoSearchTool
|
|
| 12 |
from tools.visit_webpage import VisitWebpageTool
|
| 13 |
from src.first_agent.ui import GradioUI
|
| 14 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
# --- Runtime output directory setup ---
|
| 16 |
BASE_DIR = Path.cwd()
|
| 17 |
OUTPUT_DIR = BASE_DIR / "outputs" / "final_answers"
|
|
|
|
| 12 |
from tools.visit_webpage import VisitWebpageTool
|
| 13 |
from src.first_agent.ui import GradioUI
|
| 14 |
|
| 15 |
+
import os
|
| 16 |
+
if not os.getenv("HF_TOKEN"):
|
| 17 |
+
raise RuntimeError(
|
| 18 |
+
"HF_TOKEN is not set. "
|
| 19 |
+
"Create a .env file locally or configure it in Hugging Face Spaces → Settings → Secrets."
|
| 20 |
+
)
|
| 21 |
+
|
| 22 |
# --- Runtime output directory setup ---
|
| 23 |
BASE_DIR = Path.cwd()
|
| 24 |
OUTPUT_DIR = BASE_DIR / "outputs" / "final_answers"
|