Change the way the parsable questions are expressed from numerical to percentage

#1
Files changed (1) hide show
  1. app.py +9 -2
app.py CHANGED
@@ -18,6 +18,8 @@ with demo:
18
  gr.HTML(TITLE)
19
  gr.Markdown(INTRODUCTION_TEXT, elem_classes="markdown-text")
20
 
 
 
21
  # load dataframe from csv
22
  # leaderboard_df = pd.read_csv("benchmark_results.csv")
23
  leaderboard_df = []
@@ -54,6 +56,10 @@ with demo:
54
  leaderboard_df["Num Questions Parseable"] = leaderboard_df[["Num Questions Parseable", "Error"]].apply(
55
  lambda x: parse_parseable(x), axis=1)
56
 
 
 
 
 
57
 
58
  def get_params(model_name):
59
  if model_name in metadata:
@@ -82,8 +88,9 @@ with demo:
82
  leaderboard_df = leaderboard_df.sort_values(by=["Benchmark Score", "Num Questions Parseable"],
83
  ascending=[False, False])
84
 
85
- # rename column
86
  leaderboard_df = leaderboard_df.rename(columns={"Model Path": "Model"})
 
87
 
88
  leaderboard_df_styled = leaderboard_df.style.background_gradient(cmap="RdYlGn")
89
  leaderboard_df_styled = leaderboard_df_styled.background_gradient(cmap="RdYlGn_r", subset=['Params'])
@@ -92,7 +99,7 @@ with demo:
92
  # for col in ["Benchmark Score", "Num Questions Parseable"]:
93
 
94
  rounding["Benchmark Score"] = "{:.2f}"
95
- rounding["Num Questions Parseable"] = "{:.0f}"
96
  rounding["Params"] = "{:.0f}"
97
  leaderboard_df_styled = leaderboard_df_styled.format(rounding)
98
 
 
18
  gr.HTML(TITLE)
19
  gr.Markdown(INTRODUCTION_TEXT, elem_classes="markdown-text")
20
 
21
+ NUMBER_OF_QUESTIONS = 171.0
22
+
23
  # load dataframe from csv
24
  # leaderboard_df = pd.read_csv("benchmark_results.csv")
25
  leaderboard_df = []
 
56
  leaderboard_df["Num Questions Parseable"] = leaderboard_df[["Num Questions Parseable", "Error"]].apply(
57
  lambda x: parse_parseable(x), axis=1)
58
 
59
+ def fraction_to_percentage(numerator: float, denominator: float) -> float:
60
+ return (numerator / denominator) * 100
61
+
62
+ leaderboard_df["Num Questions Parseable"] = leaderboard_df["Num Questions Parseable"].apply(lambda x: fraction_to_percentage(float(x), NUMBER_OF_QUESTIONS))
63
 
64
  def get_params(model_name):
65
  if model_name in metadata:
 
88
  leaderboard_df = leaderboard_df.sort_values(by=["Benchmark Score", "Num Questions Parseable"],
89
  ascending=[False, False])
90
 
91
+ # rename columns
92
  leaderboard_df = leaderboard_df.rename(columns={"Model Path": "Model"})
93
+ leaderboard_df = leaderboard_df.rename(columns={"Num Questions Parseable": "Percentage Questions Parseable"})
94
 
95
  leaderboard_df_styled = leaderboard_df.style.background_gradient(cmap="RdYlGn")
96
  leaderboard_df_styled = leaderboard_df_styled.background_gradient(cmap="RdYlGn_r", subset=['Params'])
 
99
  # for col in ["Benchmark Score", "Num Questions Parseable"]:
100
 
101
  rounding["Benchmark Score"] = "{:.2f}"
102
+ rounding["Percentage Questions Parseable"] = "{:.2f}"
103
  rounding["Params"] = "{:.0f}"
104
  leaderboard_df_styled = leaderboard_df_styled.format(rounding)
105