-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathrun_remote.py
More file actions
58 lines (54 loc) · 1.55 KB
/
run_remote.py
File metadata and controls
58 lines (54 loc) · 1.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
print("Enter script")
from desktop_env.desktop_env import DesktopEnv
example = {
"id": "94d95f96-9699-4208-98ba-3c3119edf9c2",
"instruction": "I want to install Spotify on my current system. Could you please help me?",
"config": [
{
"type": "execute",
"parameters": {
"command": [
"python",
"-c",
"import pyautogui; import time; pyautogui.click(960, 540); time.sleep(0.5);"
]
}
}
],
"evaluator": {
"func": "check_include_exclude",
"result": {
"type": "vm_command_line",
"command": "which spotify"
},
"expected": {
"type": "rule",
"rules": {
"include": ["spotify"],
"exclude": ["not found"]
}
}
}
}
print("Init env")
env = DesktopEnv(
action_space="pyautogui",
provider_name="docker_server",
os_type="Ubuntu",
)
print("Reset env")
obs = env.reset(task_config=example)
print("Step env")
obs, reward, done, info = env.step("pyautogui.rightClick()")
print(obs.keys())
print(reward)
print(done)
print(info)
print("Save screenshot")
# this is a base64 encoded image, decode it to a normal image
with open("screenshot.png", "wb") as _f:
_f.write(obs["screenshot"])
print(f"View UI in browser: http://10.1.110.48:{env.provider.vnc_port}/")
env.close()
# comment this line if you want to keep the emulator running, so that you can view it in the browser or reuse it
# env.close()