Pratik Bhavsar commited on
Commit
fe3dcd7
·
1 Parent(s): 267bc29

improved filter

Browse files
Files changed (1) hide show
  1. tabs/leaderboard_v2.py +61 -23
tabs/leaderboard_v2.py CHANGED
@@ -76,6 +76,30 @@ def get_type_badge(model_type):
76
  """
77
 
78
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
79
  def get_score_bar(score):
80
  """Generate HTML for score bar with gradient styling"""
81
  width = score * 100
@@ -226,6 +250,7 @@ def create_leaderboard_v2_tab():
226
  <th style="width: 80px;">Rank</th>
227
  <th>Model</th>
228
  <th style="width: 120px;">Type</th>
 
229
  <th>Vendor</th>
230
  <th style="width: 200px;">Avg Action Completion</th>
231
  <th style="width: 200px;">Avg Tool Selection Quality</th>
@@ -245,6 +270,7 @@ def create_leaderboard_v2_tab():
245
  <td>{get_rank_badge(rank)}</td>
246
  <td class="model-name">{row['Model']}</td>
247
  <td>{get_type_badge(row['Model Type'])}</td>
 
248
  <td>{row['Vendor']}</td>
249
  """
250
 
@@ -404,7 +430,7 @@ def create_leaderboard_v2_tab():
404
  if reasoning_filter != "All":
405
  if reasoning_filter == "Reasoning":
406
  filtered_df = filtered_df[filtered_df['Output Type'] == 'Reasoning']
407
- elif reasoning_filter == "Non-Reasoning":
408
  filtered_df = filtered_df[filtered_df['Output Type'] == 'Normal']
409
 
410
  # Map display name to actual column name using shared mapping
@@ -667,25 +693,37 @@ def create_leaderboard_v2_tab():
667
  }
668
 
669
  /* Column-specific widths */
670
- .dataframe th:nth-child(1), /* Model */
671
- .dataframe td:nth-child(1) {
672
  min-width: 200px !important;
673
  max-width: 250px !important;
674
  }
675
 
676
- .dataframe th:nth-child(2), /* Vendor */
677
- .dataframe td:nth-child(2) {
 
 
 
 
 
 
 
 
 
 
 
 
678
  min-width: 100px !important;
679
  max-width: 120px !important;
680
  }
681
 
682
  /* Numeric columns - smaller width */
683
- .dataframe th:nth-child(3), .dataframe th:nth-child(4),
684
- .dataframe th:nth-child(5), .dataframe th:nth-child(6),
685
- .dataframe th:nth-child(7),
686
- .dataframe td:nth-child(3), .dataframe td:nth-child(4),
687
- .dataframe td:nth-child(5), .dataframe td:nth-child(6),
688
- .dataframe td:nth-child(7) {
689
  min-width: 80px !important;
690
  max-width: 100px !important;
691
  text-align: center !important;
@@ -705,14 +743,14 @@ def create_leaderboard_v2_tab():
705
  }
706
 
707
  /* Model names - keep consistent color on hover */
708
- .dataframe td:first-child {
709
  font-weight: 500 !important;
710
  color: var(--accent-primary) !important;
711
  transition: all 0.2s ease !important;
712
  }
713
 
714
  /* Keep model name color consistent to emphasize row highlight */
715
- .dataframe tr:hover td:first-child {
716
  color: var(--accent-secondary) !important;
717
  }
718
 
@@ -768,10 +806,10 @@ def create_leaderboard_v2_tab():
768
 
769
  /* Responsive design for smaller screens */
770
  @media (max-width: 1200px) {
771
- .dataframe th:nth-child(8), /* Access column */
772
- .dataframe td:nth-child(8),
773
- .dataframe th:nth-child(9), /* Type column */
774
- .dataframe td:nth-child(9) {
775
  display: none !important;
776
  }
777
  }
@@ -787,8 +825,8 @@ def create_leaderboard_v2_tab():
787
  padding: 8px 4px !important;
788
  }
789
 
790
- .dataframe th:nth-child(1),
791
- .dataframe td:nth-child(1) {
792
  min-width: 150px !important;
793
  max-width: 200px !important;
794
  }
@@ -1918,7 +1956,7 @@ def create_leaderboard_v2_tab():
1918
 
1919
  with gr.Column(scale=1):
1920
  reasoning_filter = gr.Radio(
1921
- choices=["All", "Reasoning", "Non-Reasoning"],
1922
  value="All",
1923
  label="🧠 Output Type",
1924
  elem_classes=["compact-radio"]
@@ -2171,7 +2209,7 @@ def create_leaderboard_v2_tab():
2171
  if reasoning_filter != "All":
2172
  if reasoning_filter == "Reasoning":
2173
  filtered_df = filtered_df[filtered_df['Output Type'] == 'Reasoning']
2174
- elif reasoning_filter == "Non-Reasoning":
2175
  filtered_df = filtered_df[filtered_df['Output Type'] == 'Normal']
2176
 
2177
  # Map display name to actual column name using shared mapping
@@ -2252,7 +2290,7 @@ def create_leaderboard_v2_tab():
2252
  if reasoning_filter != "All":
2253
  if reasoning_filter == "Reasoning":
2254
  filtered_df = filtered_df[filtered_df['Output Type'] == 'Reasoning']
2255
- elif reasoning_filter == "Non-Reasoning":
2256
  filtered_df = filtered_df[filtered_df['Output Type'] == 'Normal']
2257
 
2258
  # Map display name to actual column name using shared mapping
@@ -2560,7 +2598,7 @@ def create_leaderboard_v2_tab():
2560
  if reasoning_filter != "All":
2561
  if reasoning_filter == "Reasoning":
2562
  filtered_df = filtered_df[filtered_df['Output Type'] == 'Reasoning']
2563
- elif reasoning_filter == "Non-Reasoning":
2564
  filtered_df = filtered_df[filtered_df['Output Type'] == 'Normal']
2565
 
2566
  return filtered_df
 
76
  """
77
 
78
 
79
+ def get_output_type_badge(output_type):
80
+ """Generate HTML for output type badge"""
81
+ if output_type == "Reasoning":
82
+ bg_color = "#9333ea" # Purple for reasoning
83
+ else:
84
+ bg_color = "#6b7280" # Gray for normal
85
+
86
+ return f"""
87
+ <div style="
88
+ display: inline-flex;
89
+ align-items: center;
90
+ gap: 4px;
91
+ padding: 4px 8px;
92
+ background: {bg_color};
93
+ color: white;
94
+ border-radius: 4px;
95
+ font-size: 0.85em;
96
+ font-weight: 500;
97
+ ">
98
+ {output_type}
99
+ </div>
100
+ """
101
+
102
+
103
  def get_score_bar(score):
104
  """Generate HTML for score bar with gradient styling"""
105
  width = score * 100
 
250
  <th style="width: 80px;">Rank</th>
251
  <th>Model</th>
252
  <th style="width: 120px;">Type</th>
253
+ <th style="width: 120px;">Output Type</th>
254
  <th>Vendor</th>
255
  <th style="width: 200px;">Avg Action Completion</th>
256
  <th style="width: 200px;">Avg Tool Selection Quality</th>
 
270
  <td>{get_rank_badge(rank)}</td>
271
  <td class="model-name">{row['Model']}</td>
272
  <td>{get_type_badge(row['Model Type'])}</td>
273
+ <td>{get_output_type_badge(row.get('Output Type', 'Normal'))}</td>
274
  <td>{row['Vendor']}</td>
275
  """
276
 
 
430
  if reasoning_filter != "All":
431
  if reasoning_filter == "Reasoning":
432
  filtered_df = filtered_df[filtered_df['Output Type'] == 'Reasoning']
433
+ elif reasoning_filter == "Normal":
434
  filtered_df = filtered_df[filtered_df['Output Type'] == 'Normal']
435
 
436
  # Map display name to actual column name using shared mapping
 
693
  }
694
 
695
  /* Column-specific widths */
696
+ .dataframe th:nth-child(2), /* Model */
697
+ .dataframe td:nth-child(2) {
698
  min-width: 200px !important;
699
  max-width: 250px !important;
700
  }
701
 
702
+ .dataframe th:nth-child(3), /* Model Type */
703
+ .dataframe td:nth-child(3) {
704
+ min-width: 100px !important;
705
+ max-width: 120px !important;
706
+ }
707
+
708
+ .dataframe th:nth-child(4), /* Output Type */
709
+ .dataframe td:nth-child(4) {
710
+ min-width: 100px !important;
711
+ max-width: 120px !important;
712
+ }
713
+
714
+ .dataframe th:nth-child(5), /* Vendor */
715
+ .dataframe td:nth-child(5) {
716
  min-width: 100px !important;
717
  max-width: 120px !important;
718
  }
719
 
720
  /* Numeric columns - smaller width */
721
+ .dataframe th:nth-child(6), .dataframe th:nth-child(7),
722
+ .dataframe th:nth-child(8), .dataframe th:nth-child(9),
723
+ .dataframe th:nth-child(10),
724
+ .dataframe td:nth-child(6), .dataframe td:nth-child(7),
725
+ .dataframe td:nth-child(8), .dataframe td:nth-child(9),
726
+ .dataframe td:nth-child(10) {
727
  min-width: 80px !important;
728
  max-width: 100px !important;
729
  text-align: center !important;
 
743
  }
744
 
745
  /* Model names - keep consistent color on hover */
746
+ .dataframe td:nth-child(2) {
747
  font-weight: 500 !important;
748
  color: var(--accent-primary) !important;
749
  transition: all 0.2s ease !important;
750
  }
751
 
752
  /* Keep model name color consistent to emphasize row highlight */
753
+ .dataframe tr:hover td:nth-child(2) {
754
  color: var(--accent-secondary) !important;
755
  }
756
 
 
806
 
807
  /* Responsive design for smaller screens */
808
  @media (max-width: 1200px) {
809
+ .dataframe th:nth-child(9), /* Vendor column */
810
+ .dataframe td:nth-child(9),
811
+ .dataframe th:nth-child(10), /* Last columns */
812
+ .dataframe td:nth-child(10) {
813
  display: none !important;
814
  }
815
  }
 
825
  padding: 8px 4px !important;
826
  }
827
 
828
+ .dataframe th:nth-child(2),
829
+ .dataframe td:nth-child(2) {
830
  min-width: 150px !important;
831
  max-width: 200px !important;
832
  }
 
1956
 
1957
  with gr.Column(scale=1):
1958
  reasoning_filter = gr.Radio(
1959
+ choices=["All", "Reasoning", "Normal"],
1960
  value="All",
1961
  label="🧠 Output Type",
1962
  elem_classes=["compact-radio"]
 
2209
  if reasoning_filter != "All":
2210
  if reasoning_filter == "Reasoning":
2211
  filtered_df = filtered_df[filtered_df['Output Type'] == 'Reasoning']
2212
+ elif reasoning_filter == "Normal":
2213
  filtered_df = filtered_df[filtered_df['Output Type'] == 'Normal']
2214
 
2215
  # Map display name to actual column name using shared mapping
 
2290
  if reasoning_filter != "All":
2291
  if reasoning_filter == "Reasoning":
2292
  filtered_df = filtered_df[filtered_df['Output Type'] == 'Reasoning']
2293
+ elif reasoning_filter == "Normal":
2294
  filtered_df = filtered_df[filtered_df['Output Type'] == 'Normal']
2295
 
2296
  # Map display name to actual column name using shared mapping
 
2598
  if reasoning_filter != "All":
2599
  if reasoning_filter == "Reasoning":
2600
  filtered_df = filtered_df[filtered_df['Output Type'] == 'Reasoning']
2601
+ elif reasoning_filter == "Normal":
2602
  filtered_df = filtered_df[filtered_df['Output Type'] == 'Normal']
2603
 
2604
  return filtered_df