Update todos
This commit is contained in:
34
main.py
34
main.py
@@ -4,7 +4,7 @@ import logging
|
||||
import os
|
||||
import sys
|
||||
import time
|
||||
import argparse
|
||||
|
||||
from desktop_env.envs.desktop_env import DesktopEnv
|
||||
|
||||
# Logger Configs {{{ #
|
||||
@@ -46,39 +46,29 @@ def human_agent():
|
||||
"""
|
||||
Runs the Gym environment with human input.
|
||||
"""
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('-p', '--path', type=str, required=True, help="Path to the virtual machine .vmx file.")
|
||||
parser.add_argument('-s', '--snapshot', type=str, help="Name of the snapshot to restore.")
|
||||
parser.add_argument('-e', '--example', type=str, help="Path to the example json file.")
|
||||
args = parser.parse_args(sys.argv[1:])
|
||||
|
||||
example_path = args.example if args.example is not None and os.path.exists(args.example) else \
|
||||
'evaluation_examples/examples/libreoffice_writer/6a33f9b9-0a56-4844-9c3f-96ec3ffb3ba2.json'
|
||||
with open(example_path, "r") as f:
|
||||
with open("evaluation_examples/examples/multi_apps/4c26e3f3-3a14-4d86-b44a-d3cedebbb487.json", "r", encoding="utf-8") as f:
|
||||
example = json.load(f)
|
||||
# change to your customized snapshot
|
||||
if args.snapshot is not None: example["snapshot"] = args.snapshot
|
||||
example["snapshot"] = "exp_v5"
|
||||
|
||||
assert os.path.exists(args.path), "The specified path to the .vmx file does not exist."
|
||||
env = DesktopEnv(
|
||||
path_to_vm=args.path,
|
||||
path_to_vm=r"C:\Users\tianbaox\Documents\Virtual Machines\Ubuntu3\Ubuntu3.vmx",
|
||||
action_space="computer_13",
|
||||
task_config=example
|
||||
)
|
||||
# reset the environment to certain snapshot
|
||||
observation = env.reset()
|
||||
logger.info('\x1b[32m[TASK INSTRUCTION]: \x1b[32;3m%s\x1b[0m', example["instruction"])
|
||||
done = False
|
||||
|
||||
trajectory = [
|
||||
# {
|
||||
# "action_type": "MOVE_TO",
|
||||
# "parameters": {
|
||||
# "x": 754,
|
||||
# "y": 1057
|
||||
# }
|
||||
# },
|
||||
# {"action_type": "CLICK", "parameters": {"button": "right", "num_clicks": 1}}
|
||||
{
|
||||
"action_type": "MOVE_TO", #
|
||||
"parameters": {
|
||||
"x": 754,
|
||||
"y": 1057
|
||||
}
|
||||
},
|
||||
{"action_type": "CLICK", "parameters": {"button": "right", "num_clicks": 1}}
|
||||
]
|
||||
|
||||
for i in range(len(trajectory)):
|
||||
|
||||
Reference in New Issue
Block a user