Spaces:
Runtime error
Runtime error
SpyCoder77
commited on
Commit
•
2cde005
1
Parent(s):
859079a
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Install necessary elements
|
2 |
+
from lavague.drivers.selenium import SeleniumDriver
|
3 |
+
from lavague.core import ActionEngine, WorldModel
|
4 |
+
from lavague.core.agents import WebAgent
|
5 |
+
|
6 |
+
# Set up our three key components: Driver, Action Engine, World Model
|
7 |
+
driver = SeleniumDriver(headless=False)
|
8 |
+
action_engine = ActionEngine(driver)
|
9 |
+
world_model = WorldModel()
|
10 |
+
|
11 |
+
# Create Web Agent
|
12 |
+
agent = WebAgent(world_model, action_engine)
|
13 |
+
|
14 |
+
# Set URL
|
15 |
+
agent.get("https://huggingface.co/docs")
|
16 |
+
|
17 |
+
# Run agent with a specific objective
|
18 |
+
agent.run("Go on the quicktour of PEFT")
|
19 |
+
|
20 |
+
driver = SeleniumDriver(headless=True)
|
21 |
+
action_engine = ActionEngine(driver)
|
22 |
+
world_model = WorldModel()
|
23 |
+
|
24 |
+
# Create Web Agent
|
25 |
+
agent = WebAgent(world_model, action_engine)
|
26 |
+
|
27 |
+
# Set URL
|
28 |
+
agent.get("https://huggingface.co/docs")
|
29 |
+
|
30 |
+
# Launch the agent in the Agent Gradio Demo mode
|
31 |
+
agent.demo("Go on the quicktour of PEFT")
|