|
19 | 19 | from termcolor import colored
|
20 | 20 |
|
21 | 21 | import os
|
| 22 | +from .validation_agent.validator import validate_task_vqa |
22 | 23 |
|
23 | 24 | class Evaluator:
|
24 | 25 | """Base class for evaluation strategies.
|
@@ -423,16 +424,17 @@ async def __call__(
|
423 | 424 |
|
424 | 425 | # Get path to screenshots for the given task
|
425 | 426 | test_folder = list_items_in_folder(f"{os. getcwd()}/test/logs/")[-1] # Get the most recent log folder, this may take look for the wrong folder TODO: fix to take correct folder
|
426 |
| - path_to_screenshots = f"{os. getcwd()}/test/logs/{test_folder}/log_for_task_{task_id}/snapshots" |
427 |
| - screenshot_path_list = list_items_in_folder(path_to_screenshots) # type: ignore |
428 |
| - |
| 427 | + path_to_screenshots = f"{os. getcwd()}/test/logs/{test_folder}/logs_for_task_{task_id}/snapshots" |
| 428 | + screenshot_names = list_items_in_folder(path_to_screenshots) # type: ignore |
| 429 | + |
429 | 430 | # Load and compress screenshots
|
430 |
| - for screenshot_path in screenshot_path_list: |
| 431 | + for screenshot_name in screenshot_names: |
| 432 | + screenshot_path = f"{path_to_screenshots}/{screenshot_name}" |
431 | 433 | compress_png(screenshot_path)
|
432 |
| - state_seq.append({"id":task_id, "path_to_screenshot": screenshot_path}) |
| 434 | + state_seq.append({"id":task_id, "path_to_screenshot": f"{path_to_screenshots}/{screenshot_name}"}) |
433 | 435 |
|
434 | 436 | #Calculate VQA Score
|
435 |
| - score_dict = validator.validate_task_vqa(state_seq, task) # type: ignore |
| 437 | + score_dict = validate_task_vqa(state_seq, task) # type: ignore |
436 | 438 | score = score_dict["pred_task_completed"]
|
437 | 439 |
|
438 | 440 | print(f"VQA score is {score}")
|
|
0 commit comments