mgyigit commited on
Commit
126b728
·
verified ·
1 Parent(s): 1963dd6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -25
app.py CHANGED
@@ -107,7 +107,7 @@ def get_plot_explanation(benchmark_type, x_metric, y_metric, aspect, dataset, si
107
  if benchmark_type == "function":
108
  return (
109
  f"Heat‑map shows model scores for **{aspect.upper()}** terms with **{single_metric}**. "
110
- "Darker squares → better predictions."
111
  )
112
  if benchmark_type == "family":
113
  return (
@@ -137,35 +137,31 @@ def generate_plot_and_explanation(benchmark_type, methods_selected, x_metric, y_
137
  # Custom CSS for frozen first column and clearer table styles
138
  # ---------------------------------------------------------------------------
139
  CUSTOM_CSS = """
140
- /* Freeze first column & improve scrolling for static Dataframe output */
141
- #leaderboard-table .dataframe-wrap {
142
- overflow-x: auto;
143
- overflow-y: auto;
144
- max-height: 650px; /* taller table */
145
- }
146
- #leaderboard-table table {
147
- border-collapse: collapse;
148
- }
149
- #leaderboard-table thead th,
150
- #leaderboard-table tbody td {
151
- padding: 4px 6px;
152
- }
153
- #leaderboard-table thead th:first-child,
154
- #leaderboard-table tbody td:first-child {
155
  position: sticky;
156
  left: 0;
157
  background: white;
158
- z-index: 3; /* stay on top */
159
- box-shadow: 2px 0 2px -2px #aaa; /* subtle divider */
160
  }
161
- /* striped rows */
162
- #leaderboard-table tbody tr:nth-child(odd) {
 
163
  background: #fafafa;
164
  }
165
- /* center numeric columns */
166
- #leaderboard-table tbody td:not(:first-child) {
 
167
  text-align: center;
168
  }
 
 
 
 
 
 
 
169
  """
170
 
171
  # ---------------------------------------------------------------------------
@@ -188,7 +184,7 @@ with block:
188
  height=1000,
189
  container=False,
190
  )
191
- # explanatory sentence just below the figure
192
  gr.Markdown(
193
  "## For detailed explanations of the metrics and benchmarks, please refer to the 📝 About tab.",
194
  elem_classes="leaderboard-note",
@@ -239,7 +235,8 @@ with block:
239
  datatype=baseline_datatype,
240
  interactive=False,
241
  elem_id="leaderboard-table",
242
- # make table longer
 
243
  )
244
 
245
  # callbacks
@@ -381,4 +378,4 @@ with block:
381
  )
382
 
383
  # ---------------------------------------------------------------------------
384
- block.launch()
 
107
  if benchmark_type == "function":
108
  return (
109
  f"Heat‑map shows model scores for **{aspect.upper()}** terms with **{single_metric}**. "
110
+ "Darker squares → better predictions."
111
  )
112
  if benchmark_type == "family":
113
  return (
 
137
  # Custom CSS for frozen first column and clearer table styles
138
  # ---------------------------------------------------------------------------
139
  CUSTOM_CSS = """
140
+ /* freeze first column */
141
+ #leaderboard-table table tr th:first-child,
142
+ #leaderboard-table table tr td:first-child {
 
 
 
 
 
 
 
 
 
 
 
 
143
  position: sticky;
144
  left: 0;
145
  background: white;
146
+ z-index: 2;
 
147
  }
148
+
149
+ /* striped rows for readability */
150
+ #leaderboard-table table tr:nth-child(odd) {
151
  background: #fafafa;
152
  }
153
+
154
+ /* centre numeric cells */
155
+ #leaderboard-table td:not(:first-child) {
156
  text-align: center;
157
  }
158
+
159
+ /* scrollable and taller table */
160
+ #leaderboard-table .dataframe-wrap {
161
+ max-height: 1200px;
162
+ overflow-y: auto;
163
+ overflow-x: auto;
164
+ }
165
  """
166
 
167
  # ---------------------------------------------------------------------------
 
184
  height=1000,
185
  container=False,
186
  )
187
+
188
  gr.Markdown(
189
  "## For detailed explanations of the metrics and benchmarks, please refer to the 📝 About tab.",
190
  elem_classes="leaderboard-note",
 
235
  datatype=baseline_datatype,
236
  interactive=False,
237
  elem_id="leaderboard-table",
238
+ pinned_columns=1,
239
+ max_height=1000,
240
  )
241
 
242
  # callbacks
 
378
  )
379
 
380
  # ---------------------------------------------------------------------------
381
+ block.launch()