shyuli commited on
Commit
b1cccfe
·
1 Parent(s): fb4956b

version v0.1

Browse files
Files changed (2) hide show
  1. README.md +1 -1
  2. src/envs.py +28 -5
README.md CHANGED
@@ -1,5 +1,5 @@
1
  ---
2
- title: SearchAgent Leaderboard
3
  emoji: 🥇
4
  colorFrom: green
5
  colorTo: indigo
 
1
  ---
2
+ title: SearchAgent_Leaderboard
3
  emoji: 🥇
4
  colorFrom: green
5
  colorTo: indigo
src/envs.py CHANGED
@@ -4,17 +4,40 @@ from huggingface_hub import HfApi
4
 
5
  # Info to change for your repository
6
  # ----------------------------------
7
- TOKEN = os.environ.get("HF_TOKEN") # A read/write token for your org
8
 
9
- OWNER = "searchagent-leaderboard" # Change to your org - don't forget to create a results and request dataset, with the correct format!
10
- # ----------------------------------
11
 
12
  REPO_ID = f"{OWNER}/leaderboard"
13
  QUEUE_REPO = f"{OWNER}/requests"
14
  RESULTS_REPO = f"{OWNER}/results"
15
 
16
- # If you setup a cache later, just change HF_HOME
17
- CACHE_PATH=os.getenv("HF_HOME", ".")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18
 
19
  # Local caches
20
  EVAL_REQUESTS_PATH = os.path.join(CACHE_PATH, "eval-queue")
 
4
 
5
  # Info to change for your repository
6
  # ----------------------------------
7
+ TOKEN = os.environ.get("HF_TOKEN") # A read/write token for your org
8
 
9
+ OWNER = "searchagent_leaderboard"
 
10
 
11
  REPO_ID = f"{OWNER}/leaderboard"
12
  QUEUE_REPO = f"{OWNER}/requests"
13
  RESULTS_REPO = f"{OWNER}/results"
14
 
15
+ # Resolve project root (two levels up from this file when packaged)
16
+ _SRC_DIR = os.path.dirname(os.path.abspath(__file__))
17
+ _PROJECT_ROOT = os.path.abspath(os.path.join(_SRC_DIR, os.pardir))
18
+
19
+
20
+ def _resolve_cache_path() -> str:
21
+ """Determine where eval assets should be read from."""
22
+ # Highest priority: explicit environment override
23
+ env_override = os.getenv("EVAL_CACHE_PATH")
24
+ if env_override:
25
+ return os.path.abspath(env_override)
26
+
27
+ # Next: if HF_HOME contains the expected folders, use it
28
+ hf_home = os.getenv("HF_HOME")
29
+ if hf_home:
30
+ hf_home = os.path.abspath(hf_home)
31
+ expected_results = os.path.join(hf_home, "eval-results")
32
+ expected_queue = os.path.join(hf_home, "eval-queue")
33
+ if os.path.isdir(expected_results) or os.path.isdir(expected_queue):
34
+ return hf_home
35
+
36
+ # Fallback to project root so bundled demo data is found
37
+ return _PROJECT_ROOT
38
+
39
+
40
+ CACHE_PATH = _resolve_cache_path()
41
 
42
  # Local caches
43
  EVAL_REQUESTS_PATH = os.path.join(CACHE_PATH, "eval-queue")