carolinacon commited on
Commit
c57274b
·
1 Parent(s): eed7c9e

check dependencies at startup

Browse files
Files changed (2) hide show
  1. app.py +3 -0
  2. utils/dependencies_checker.py +32 -0
app.py CHANGED
@@ -6,6 +6,7 @@ from pathlib import Path
6
 
7
 
8
  from core.agent import GaiaAgent, Attachment
 
9
 
10
  # (Keep Constants as is)
11
  # --- Constants ---
@@ -232,6 +233,8 @@ if __name__ == "__main__":
232
  print("ℹ️ SPACE_ID environment variable not found (running locally?). Repo URL cannot be determined.")
233
 
234
  print("-"*(60 + len(" App Starting ")) + "\n")
 
 
235
 
236
  print("Launching Gradio Interface for Basic Agent Evaluation...")
237
  demo.launch(debug=True, share=False)
 
6
 
7
 
8
  from core.agent import GaiaAgent, Attachment
9
+ from utils.dependencies_checker import check_dependencies
10
 
11
  # (Keep Constants as is)
12
  # --- Constants ---
 
233
  print("ℹ️ SPACE_ID environment variable not found (running locally?). Repo URL cannot be determined.")
234
 
235
  print("-"*(60 + len(" App Starting ")) + "\n")
236
+ print("-"*(60 + len(" Check dependencies ")) + "\n")
237
+ check_dependencies()
238
 
239
  print("Launching Gradio Interface for Basic Agent Evaluation...")
240
  demo.launch(debug=True, share=False)
utils/dependencies_checker.py ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import shutil
3
+
4
+
5
+ def find_stockfish_path():
6
+ # Try to find stockfish in PATH
7
+ path = shutil.which("stockfish")
8
+ if path:
9
+ return path
10
+
11
+ # Try common locations if not in PATH
12
+ common_paths = [
13
+ "/usr/bin/stockfish",
14
+ "/usr/games/stockfish",
15
+ "/usr/local/bin/stockfish",
16
+ "/opt/homebrew/bin/stockfish", # macOS with Homebrew
17
+ "C:\\stockfish\\stockfish.exe", # Windows
18
+ ]
19
+
20
+ for path in common_paths:
21
+ if os.path.exists(path):
22
+ return path
23
+
24
+ return None
25
+
26
+
27
+ def check_dependencies():
28
+ stockfish_path = find_stockfish_path()
29
+ if stockfish_path:
30
+ print(f"Found Stockfish at: {stockfish_path}")
31
+ else:
32
+ print("Stockfish not found!")