Files
sci-gui-agent-benchmark/main.py
2023-12-03 17:17:25 +08:00

46 lines
1.1 KiB
Python

from desktop_env.envs.desktop_env import DesktopEnv
def human_agent():
"""
Runs the Gym environment with human input.
"""
env = DesktopEnv(
path_to_vm=r"""C:\Users\tianbaox\Documents\Virtual Machines\Win10\Win10.vmx""",
# path_to_vm="/home/yuri/vmware/Ubuntu 64-bit/Ubuntu 64-bit.vmx",
snapshot_path="base3",
)
# reset the environment to certain snapshot
observation = env.reset()
done = False
for i in range(2):
# action = get_human_action()
# action = {
# "action_type": 0,
# "click_type": 3,
# }
action = "pyautogui.moveTo(10, 100)" if i == 0 else "pyautogui.click(button='right')"
observation, reward, done, info = env.step(action)
print("Observation:", observation)
print("Reward:", reward)
print("Info:", info)
print("================================\n")
if done:
print("The episode is done.")
break
env.close()
print("Environment closed.")
if __name__ == "__main__":
human_agent()