update path exist judgement

This commit is contained in:
better629 2024-03-28 10:02:06 +08:00
parent 120cce07e5
commit 33e8640f47
4 changed files with 4 additions and 7 deletions

View file

@ -47,10 +47,8 @@ class ManualRecord(Action):
self.screenshot_before_path = Path(task_dir) / "raw_screenshots"
self.screenshot_after_path = Path(task_dir) / "labeled_screenshots"
self.xml_path = Path(task_dir) / "xml"
for path in [self.screenshot_before_path, self.screenshot_after_path, self.xml_path]:
if not path.exists():
path.mkdir(parents=True, exist_ok=True)
path.mkdir(parents=True, exist_ok=True)
self.record_path.write_text("")
record_file = open(self.record_path, "w")

View file

@ -36,12 +36,13 @@ class ParseRecord(Action):
screenshot_after_path: Path = ""
async def run(self, app_name: str, task_dir: Path, docs_dir: Path):
docs_dir.mkdir(parents=True, exist_ok=True)
doc_count = 0
self.record_path = Path(task_dir) / "record.txt"
self.task_desc_path = Path(task_dir) / "task_desc.txt"
self.screenshot_before_path = Path(task_dir) / "raw_screenshots"
self.screenshot_after_path = Path(task_dir) / "labeled_screenshots"
for path in [self.screenshot_before_path, self.screenshot_after_path]:
path.mkdir(parents=True, exist_ok=True)
task_desc = self.task_desc_path.read_text()

View file

@ -100,8 +100,7 @@ class ScreenshotParse(Action):
env: AndroidEnv,
):
for path in [task_dir, docs_dir]:
if not path.exists():
path.mkdir(parents=True, exist_ok=True)
path.mkdir(parents=True, exist_ok=True)
screenshot_path: Path = env.observe(
EnvObsParams(obs_type=EnvObsType.GET_SCREENSHOT, ss_name=f"{round_count}_before", local_save_dir=task_dir)
)

View file

@ -1 +0,0 @@
{'tap': '[CONTENT]\n{\n "Observation": "The first image shows a mobile device\'s home screen with various app icons and a Google search bar at the top. The second image displays an app drawer with a grid of apps and a search bar at the top, indicating that the UI element has been tapped.",\n "Thought": "Tapping the UI element opens the app drawer, which is a common function in mobile operating systems to access a list of all installed apps.",\n "Description": "Tapping this area will open the app drawer, displaying a list of all installed applications."\n}\n[/CONTENT]', 'text': '', 'v_swipe': '', 'h_swipe': '', 'long_press': ''}