Files
AutoGPT/classic/benchmark/agbenchmark/reports/processing/gen_combined_chart.py
Swifty ef7cfbb860 refactor: AutoGPT Platform Stealth Launch Repo Re-Org (#8113)
Restructuring the Repo to make it clear the difference between classic autogpt and the autogpt platform:
* Move the "classic" projects `autogpt`, `forge`, `frontend`, and `benchmark` into a `classic` folder
  * Also rename `autogpt` to `original_autogpt` for absolute clarity
* Rename `rnd/` to `autogpt_platform/`
  * `rnd/autogpt_builder` -> `autogpt_platform/frontend`
  * `rnd/autogpt_server` -> `autogpt_platform/backend`
* Adjust any paths accordingly
2024-09-20 16:50:43 +02:00

46 lines
1.3 KiB
Python

import json
import os
from pathlib import Path
from agbenchmark.reports.processing.graphs import (
save_combined_bar_chart,
save_combined_radar_chart,
)
from agbenchmark.reports.processing.process_report import (
all_agent_categories,
get_reports_data,
)
def generate_combined_chart() -> None:
all_agents_path = Path(__file__).parent.parent.parent.parent / "reports"
combined_charts_folder = all_agents_path / "combined_charts"
reports_data = get_reports_data(str(all_agents_path))
categories = all_agent_categories(reports_data)
# Count the number of directories in this directory
num_dirs = len([f for f in combined_charts_folder.iterdir() if f.is_dir()])
run_charts_folder = combined_charts_folder / f"run{num_dirs + 1}"
if not os.path.exists(run_charts_folder):
os.makedirs(run_charts_folder)
info_data = {
report_name: data.benchmark_start_time
for report_name, data in reports_data.items()
if report_name in categories
}
with open(Path(run_charts_folder) / "run_info.json", "w") as f:
json.dump(info_data, f)
save_combined_radar_chart(categories, Path(run_charts_folder) / "radar_chart.png")
save_combined_bar_chart(categories, Path(run_charts_folder) / "bar_chart.png")
if __name__ == "__main__":
generate_combined_chart()