GiantAnalytics commited on
Commit
3a01954
·
verified ·
1 Parent(s): be35e50

Update VisionaryAgent.py

Browse files
Files changed (1) hide show
  1. VisionaryAgent.py +9 -8
VisionaryAgent.py CHANGED
@@ -17,26 +17,27 @@ from selenium import webdriver
17
  import helium
18
  from selenium.webdriver.chrome.service import Service
19
 
20
- # Ensure the system uses the installed Chromium and Chromedriver
 
 
 
 
21
  chrome_options = webdriver.ChromeOptions()
22
- chrome_options.binary_location = "/usr/bin/chromium-browser" # Specify Chromium path
23
- chrome_options.add_argument("--headless") # Run Chrome in headless mode
24
  chrome_options.add_argument("--no-sandbox") # Required for Hugging Face Spaces
25
  chrome_options.add_argument("--disable-dev-shm-usage") # Prevents memory issues
26
  chrome_options.add_argument("--disable-gpu") # Disable GPU acceleration
27
  chrome_options.add_argument("--remote-debugging-port=9222") # Helps debugging
28
 
29
- # Correct Chromedriver setup using Selenium 4
30
- chromedriver_path = "/usr/bin/chromedriver"
31
- service = Service(chromedriver_path)
32
  driver = webdriver.Chrome(service=service, options=chrome_options)
33
 
34
  # Start Helium using the modified driver
35
  helium.set_driver(driver)
36
 
37
 
38
-
39
-
40
  # Load environment variables (API keys, etc.)
41
  from dotenv import load_dotenv
42
  load_dotenv()
 
17
  import helium
18
  from selenium.webdriver.chrome.service import Service
19
 
20
+ # Set paths explicitly
21
+ CHROME_PATH = "/usr/bin/chromium-browser"
22
+ CHROMEDRIVER_PATH = "/usr/local/bin/chromedriver"
23
+
24
+ # Configure Chrome options for Hugging Face Spaces
25
  chrome_options = webdriver.ChromeOptions()
26
+ chrome_options.binary_location = CHROME_PATH # Manually specify Chromium binary
27
+ chrome_options.add_argument("--headless") # Run in headless mode
28
  chrome_options.add_argument("--no-sandbox") # Required for Hugging Face Spaces
29
  chrome_options.add_argument("--disable-dev-shm-usage") # Prevents memory issues
30
  chrome_options.add_argument("--disable-gpu") # Disable GPU acceleration
31
  chrome_options.add_argument("--remote-debugging-port=9222") # Helps debugging
32
 
33
+ # Initialize Chrome WebDriver with the correct service path
34
+ service = Service(CHROMEDRIVER_PATH)
 
35
  driver = webdriver.Chrome(service=service, options=chrome_options)
36
 
37
  # Start Helium using the modified driver
38
  helium.set_driver(driver)
39
 
40
 
 
 
41
  # Load environment variables (API keys, etc.)
42
  from dotenv import load_dotenv
43
  load_dotenv()