mgyigit commited on
Commit
10afd07
·
verified ·
1 Parent(s): b20cd7e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -13
app.py CHANGED
@@ -15,19 +15,19 @@ global data_component, filter_component
15
 
16
  def get_baseline_df(selected_methods, selected_metrics):
17
  df = pd.read_csv(CSV_RESULT_PATH)
18
- present_columns = ["Method"] + selected_metrics
19
- df = df[df['Method'].isin(selected_methods)][present_columns]
20
  return df
21
 
22
  # Function to create the plot
23
  def create_plot(methods_selected, x_metric, y_metric):
24
  df = pd.read_csv(CSV_RESULT_PATH)
25
- filtered_df = df[df['Method'].isin(methods_selected)]
26
 
27
  # Create a larger plot
28
  plt.figure(figsize=(10, 8)) # Increase the figure size
29
  for method in methods_selected:
30
- method_data = filtered_df[filtered_df['Method'] == method]
31
  plt.plot(method_data[x_metric], method_data[y_metric], label=method, marker='o')
32
 
33
  plt.xlabel(x_metric)
@@ -70,12 +70,17 @@ with block:
70
  with gr.Tabs(elem_classes="tab-buttons") as tabs:
71
  # table jmmmu bench
72
  with gr.TabItem("🏅 PROBE Benchmark", elem_id="probe-benchmark-tab-table", id=1):
73
-
 
 
 
 
 
74
  # Leaderboard section with method and metric selectors
75
  with gr.Row():
76
  # Add method and metric selectors for leaderboard
77
  leaderboard_method_selector = gr.CheckboxGroup(
78
- choices=method_names, label="Select Methods for Leaderboard", value=method_names, interactive=True
79
  )
80
  leaderboard_metric_selector = gr.CheckboxGroup(
81
  choices=metric_names, label="Select Metrics for Leaderboard", value=metric_names, interactive=True
@@ -83,7 +88,7 @@ with block:
83
 
84
  # Display the filtered leaderboard
85
  baseline_value = get_baseline_df(method_names, metric_names)
86
- baseline_header = ["Method"] + metric_names
87
  baseline_datatype = ['markdown'] + ['number'] * len(metric_names)
88
 
89
  data_component = gr.components.Dataframe(
@@ -109,15 +114,12 @@ with block:
109
 
110
  # Add the visualizer components (Dropdown, Checkbox, Button, Image)
111
  with gr.Row():
112
- method_names = pd.read_csv(CSV_RESULT_PATH)['Method'].unique().tolist()
113
- metric_names = pd.read_csv(CSV_RESULT_PATH).columns.tolist()
114
- metric_names.remove('Method') # Remove Method from the metric options
115
 
116
  # Visualizer Controls: Smaller and underneath each other
117
  with gr.Column(scale=1):
118
- method_selector = gr.CheckboxGroup(choices=method_names, label="Select Methods", interactive=True, value=method_names)
119
- x_metric_selector = gr.Dropdown(choices=metric_names, label="Select X-axis Metric", interactive=True)
120
- y_metric_selector = gr.Dropdown(choices=metric_names, label="Select Y-axis Metric", interactive=True)
121
  plot_button = gr.Button("Plot")
122
 
123
  # Larger plot display
 
15
 
16
  def get_baseline_df(selected_methods, selected_metrics):
17
  df = pd.read_csv(CSV_RESULT_PATH)
18
+ present_columns = ["method_name"] + selected_metrics
19
+ df = df[df['method_name'].isin(selected_methods)][present_columns]
20
  return df
21
 
22
  # Function to create the plot
23
  def create_plot(methods_selected, x_metric, y_metric):
24
  df = pd.read_csv(CSV_RESULT_PATH)
25
+ filtered_df = df[df['method_name'].isin(methods_selected)]
26
 
27
  # Create a larger plot
28
  plt.figure(figsize=(10, 8)) # Increase the figure size
29
  for method in methods_selected:
30
+ method_data = filtered_df[filtered_df['method_name'] == method]
31
  plt.plot(method_data[x_metric], method_data[y_metric], label=method, marker='o')
32
 
33
  plt.xlabel(x_metric)
 
70
  with gr.Tabs(elem_classes="tab-buttons") as tabs:
71
  # table jmmmu bench
72
  with gr.TabItem("🏅 PROBE Benchmark", elem_id="probe-benchmark-tab-table", id=1):
73
+
74
+ method_names = pd.read_csv(CSV_RESULT_PATH)['method_name'].unique().tolist()
75
+ metric_names = pd.read_csv(CSV_RESULT_PATH).columns.tolist()
76
+ metrics_with_method = metric_names
77
+ metric_names.remove('method_name') # Remove method_name from the metric options
78
+
79
  # Leaderboard section with method and metric selectors
80
  with gr.Row():
81
  # Add method and metric selectors for leaderboard
82
  leaderboard_method_selector = gr.CheckboxGroup(
83
+ choices=method_names, label="Select method_names for Leaderboard", value=method_names, interactive=True
84
  )
85
  leaderboard_metric_selector = gr.CheckboxGroup(
86
  choices=metric_names, label="Select Metrics for Leaderboard", value=metric_names, interactive=True
 
88
 
89
  # Display the filtered leaderboard
90
  baseline_value = get_baseline_df(method_names, metric_names)
91
+ baseline_header = ["method_name"] + metric_names
92
  baseline_datatype = ['markdown'] + ['number'] * len(metric_names)
93
 
94
  data_component = gr.components.Dataframe(
 
114
 
115
  # Add the visualizer components (Dropdown, Checkbox, Button, Image)
116
  with gr.Row():
 
 
 
117
 
118
  # Visualizer Controls: Smaller and underneath each other
119
  with gr.Column(scale=1):
120
+ method_selector = gr.CheckboxGroup(choices=method_names, label="Select method_names", interactive=True, value=method_names)
121
+ x_metric_selector = gr.Dropdown(choices=metrics_with_method, label="Select X-axis Metric", interactive=True)
122
+ y_metric_selector = gr.Dropdown(choices=metrics_with_method, label="Select Y-axis Metric", interactive=True)
123
  plot_button = gr.Button("Plot")
124
 
125
  # Larger plot display