diff --git a/dbgpt_hub/baseline/show_result.py b/dbgpt_hub/baseline/show_result.py index a79236d..f80853a 100644 --- a/dbgpt_hub/baseline/show_result.py +++ b/dbgpt_hub/baseline/show_result.py @@ -3,11 +3,31 @@ import json from typing import Optional, Dict, Any from prettytable.colortable import ColorTable, Theme +from prettytable.colortable import ColorTable, Theme ROOT_PATH = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) sys.path.append(ROOT_PATH) +MYTHEME = Theme( + default_color="96", # blue + vertical_color="31", # red + horizontal_color="33", # yellow + junction_color="97", # white +) +HEADER = [ + "dataset", + "model", + "method", + "prompt", + "etype", + "easy", + "medium", + "hard", + "extra", + "all", +] + MYTHEME = Theme( default_color="96", # blue vertical_color="31", # red @@ -28,6 +48,7 @@ ] baseline_file = "./dbgpt_hub/baseline/baseline.json" + with open(baseline_file, "r") as file: baseline_json = json.load(file) @@ -137,6 +158,8 @@ def show_scores(): datasets = baseline_json.keys() table_scores = ColorTable(theme=MYTHEME) table_scores.field_names = HEADER + table_scores = ColorTable(theme=MYTHEME) + table_scores.field_names = HEADER for dataset in datasets: models = baseline_json[dataset].keys() for model in models: @@ -145,10 +168,13 @@ def show_scores(): prompts = baseline_json[dataset][model][method].keys() for prompt in prompts: acc_data = baseline_json[dataset][model][method][prompt]["acc"] + table_scores = table_add_row( + table_scores, acc_data, dataset, model, method, prompt table_scores = table_add_row( table_scores, acc_data, dataset, model, method, prompt ) print(table_scores, "\n") + print(table_scores, "\n") def show_scores_api(): diff --git a/dbgpt_hub/baseline/show_result_api.py b/dbgpt_hub/baseline/show_result_api.py index ec2db96..5b955a7 100644 --- a/dbgpt_hub/baseline/show_result_api.py +++ b/dbgpt_hub/baseline/show_result_api.py @@ -3,10 +3,14 @@ from dbgpt_hub.baseline import show_result +def show_scores(): + show_result.show_scores_api() def show_scores(): show_result.show_scores_api() +def show_score(dataset=None, model=None, method=None, prompt=None): + show_result.show_score_api(dataset, model, method, prompt) def show_score(dataset=None, model=None, method=None, prompt=None): show_result.show_score_api(dataset, model, method, prompt)