albertvillanova HF staff commited on
Commit
a56da8a
1 Parent(s): 2b1d96b

Plot also radar

Browse files
Files changed (2) hide show
  1. app.py +4 -2
  2. src/results.py +14 -4
app.py CHANGED
@@ -63,7 +63,9 @@ with gr.Blocks(fill_height=True, fill_width=True, css=".col_heading {width: 50%}
63
  visible=False,
64
  )
65
  hide_std_errors = gr.Checkbox(label="Hide Standard Errors", value=True, info="Options")
66
- results_plot = gr.Plot()
 
 
67
  results = gr.HTML()
68
  results_dataframe_1 = gr.Dataframe(visible=False)
69
  results_dataframe_2 = gr.Dataframe(visible=False)
@@ -158,7 +160,7 @@ with gr.Blocks(fill_height=True, fill_width=True, css=".col_heading {width: 50%}
158
  ).then(
159
  fn=plot_results,
160
  inputs=[results_task, results_dataframe_1, results_dataframe_2], # results,
161
- outputs=results_plot,
162
  )
163
  gr.on(
164
  triggers=[clear_results_btn.click, clear_configs_btn.click],
 
63
  visible=False,
64
  )
65
  hide_std_errors = gr.Checkbox(label="Hide Standard Errors", value=True, info="Options")
66
+ with gr.Row():
67
+ results_plot_1 = gr.Plot(visible=True)
68
+ results_plot_2 = gr.Plot(visible=True)
69
  results = gr.HTML()
70
  results_dataframe_1 = gr.Dataframe(visible=False)
71
  results_dataframe_2 = gr.Dataframe(visible=False)
 
160
  ).then(
161
  fn=plot_results,
162
  inputs=[results_task, results_dataframe_1, results_dataframe_2], # results,
163
+ outputs=[results_plot_1, results_plot_2],
164
  )
165
  gr.on(
166
  triggers=[clear_results_btn.click, clear_configs_btn.click],
src/results.py CHANGED
@@ -2,6 +2,7 @@ import asyncio
2
 
3
  import gradio as gr
4
  import pandas as pd
 
5
 
6
  import src.constants as constants
7
  from src.constants import TASKS
@@ -181,11 +182,20 @@ def plot_results(task, *dfs):
181
  df = df.rename(columns=lambda col: col.split(".")[2].removesuffix(",none"))
182
  else:
183
  df = df.rename(columns=lambda col: tasks.get(col.split(".")[1], subtasks.get(col.split(".")[1])))
184
- fig = df.T.rename_axis(columns="Model").plot.bar(
185
- backend="plotly",
186
  barmode="group",
187
  labels={"index": "Benchmark" if task == "All" else "Subtask", "value": "Score"},
188
  color_discrete_sequence=["#FF9D00", "#32343D"],
189
  )
190
- fig.update_yaxes(range=[0, 1])
191
- return fig
 
 
 
 
 
 
 
 
 
 
2
 
3
  import gradio as gr
4
  import pandas as pd
5
+ import plotly.express as px
6
 
7
  import src.constants as constants
8
  from src.constants import TASKS
 
182
  df = df.rename(columns=lambda col: col.split(".")[2].removesuffix(",none"))
183
  else:
184
  df = df.rename(columns=lambda col: tasks.get(col.split(".")[1], subtasks.get(col.split(".")[1])))
185
+ fig_1 = px.bar(
186
+ df.T.rename_axis(columns="Model"),
187
  barmode="group",
188
  labels={"index": "Benchmark" if task == "All" else "Subtask", "value": "Score"},
189
  color_discrete_sequence=["#FF9D00", "#32343D"],
190
  )
191
+ fig_1.update_yaxes(range=[0, 1])
192
+ fig_2 = px.line_polar(
193
+ df.melt(ignore_index=False, var_name="Benchmark", value_name="Score").reset_index(names="Model"),
194
+ r="Score", theta="Benchmark", color="Model",
195
+ line_close=True,
196
+ range_r=[0, 1],
197
+ color_discrete_sequence=["#FF9D00", "#32343D"],
198
+ )
199
+ return fig_1, fig_2
200
+ else:
201
+ return None, None