Add human operation time log

This commit is contained in:
BlankCheng
2024-01-29 21:42:16 +08:00
parent 460507b5c3
commit 284d6fb379
20 changed files with 958 additions and 76 deletions

31
main.py
View File

@@ -3,6 +3,7 @@ import json
import logging
import os
import sys
import time
from desktop_env.envs.desktop_env import DesktopEnv
@@ -46,12 +47,11 @@ def human_agent():
Runs the Gym environment with human input.
"""
with open("evaluation_examples/examples/libreoffice_writer/72b810ef-4156-4d09-8f08-a0cf57e7cefe.json", "r") as f:
with open("evaluation_examples/examples/gimp/734d6579-c07d-47a8-9ae2-13339795476b.json", "r") as f:
example = json.load(f)
example["snapshot"] = "base18"
example["snapshot"] = "快照 9"
env = DesktopEnv(
path_to_vm=r"D:\Ubuntu\Ubuntu\Ubuntu.vmx",
path_to_vm=r"~/Virtual Machines.localized/ubuntu_vm.vmwarevm/ubuntu_vm.vmx",
action_space="computer_13",
task_config=example
)
@@ -60,14 +60,14 @@ def human_agent():
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": 1,
# "y": 1
# }
# },
# {"action_type": "CLICK", "parameters": {"button": "right", "num_clicks": 1}}
]
for i in range(len(trajectory)):
@@ -91,13 +91,14 @@ def human_agent():
logger.info("The episode is done.")
break
#input("PAUSING")
input("Press Enter to start human operation...")
human_start_time = time.time()
input("Press Enter to finish human operation.")
print("Time elapsed of human operation: %.2f" % (time.time() - human_start_time))
result = env.evaluate()
logger.info("Result: %.2f", result)
#input("PAUSING")
# env.close()
logger.info("Environment closed.")