GiantAnalytics commited on
Commit
38dad88
·
verified ·
1 Parent(s): d64d9a0

Update VisionaryAgent.py

Browse files
Files changed (1) hide show
  1. VisionaryAgent.py +13 -2
VisionaryAgent.py CHANGED
@@ -13,6 +13,17 @@ import helium
13
  from typing import List
14
  from pydantic import BaseModel, Field
15
  from fastapi import UploadFile
 
 
 
 
 
 
 
 
 
 
 
16
 
17
  # Load environment variables (API keys, etc.)
18
  from dotenv import load_dotenv
@@ -56,8 +67,8 @@ def scrape_website(url: str):
56
  return firecrawl_agent.print_response(f"Extract all relevant business information from {url}, including mission statement, services, case studies, and AI-related content. Provide structured output.")
57
 
58
  # Helium for dynamic websites
59
- chrome_options = webdriver.ChromeOptions()
60
- chrome_options.add_argument("--headless")
61
  driver = helium.start_chrome(headless=True, options=chrome_options)
62
 
63
  def scrape_dynamic_website(url: str):
 
13
  from typing import List
14
  from pydantic import BaseModel, Field
15
  from fastapi import UploadFile
16
+ from selenium import webdriver
17
+ import helium
18
+
19
+ # Configure Chrome options for Hugging Face Spaces
20
+ chrome_options = webdriver.ChromeOptions()
21
+ chrome_options.add_argument("--headless") # Runs Chrome in headless mode
22
+ chrome_options.add_argument("--no-sandbox") # Required for running on HF Spaces
23
+ chrome_options.add_argument("--disable-dev-shm-usage") # Prevents memory errors
24
+ chrome_options.add_argument("--disable-gpu") # Disable GPU acceleration (not needed in headless mode)
25
+ chrome_options.add_argument("--remote-debugging-port=9222") # Helps with debugging if needed
26
+
27
 
28
  # Load environment variables (API keys, etc.)
29
  from dotenv import load_dotenv
 
67
  return firecrawl_agent.print_response(f"Extract all relevant business information from {url}, including mission statement, services, case studies, and AI-related content. Provide structured output.")
68
 
69
  # Helium for dynamic websites
70
+ # chrome_options = webdriver.ChromeOptions()
71
+ # chrome_options.add_argument("--headless")
72
  driver = helium.start_chrome(headless=True, options=chrome_options)
73
 
74
  def scrape_dynamic_website(url: str):