iruno commited on
Commit
6a7ac36
·
verified ·
1 Parent(s): 2cf79ca

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -7
app.py CHANGED
@@ -25,13 +25,16 @@ def install_browsergym():
25
 
26
  # Verify BrowserGym is importable
27
  try:
28
- from browsergym.core.action.highlevel import HighLevelActionSet
29
- from browsergym.utils.obs import (
30
- flatten_axtree_to_str,
31
- flatten_dom_to_str,
32
- prune_html,
33
- )
34
- from browsergym.experiments import Agent
 
 
 
35
  print("BrowserGym successfully imported")
36
  except ImportError as e:
37
  print(f"BrowserGym import verification failed: {e}")
 
25
 
26
  # Verify BrowserGym is importable
27
  try:
28
+ import importlib.util
29
+
30
+ # Try to import HighLevelActionSet
31
+ spec = importlib.util.find_spec("browsergym.core.action.highlevel")
32
+ if spec is None:
33
+ print("Module browsergym.core.action.highlevel not found")
34
+ else:
35
+ module = importlib.util.module_from_spec(spec)
36
+ spec.loader.exec_module(module)
37
+ HighLevelActionSet = getattr(module, "HighLevelActionSet")
38
  print("BrowserGym successfully imported")
39
  except ImportError as e:
40
  print(f"BrowserGym import verification failed: {e}")