juancauma commited on
Commit
57f6cce
·
1 Parent(s): 0ab0b5b

separated css

Browse files
Files changed (2) hide show
  1. app.py +7 -3
  2. styles.css +49 -0
app.py CHANGED
@@ -3,6 +3,10 @@ import pandas as pd
3
  import json
4
  import os
5
 
 
 
 
 
6
  def strip_timestamp(name):
7
  """Remove the timestamp portion from the model name."""
8
  parts = name.split('-')
@@ -157,7 +161,7 @@ def create_grouped_leaderboard(selected_mwoz, selected_tau_airline, selected_tau
157
  if sort_by in allowed_sort_cols:
158
  df = df.sort_values(sort_by, ascending=ascending)
159
 
160
- # Reorder columns to make "Rank" the first column.
161
  cols = df.columns.tolist()
162
  if "Rank" in cols:
163
  cols.insert(0, cols.pop(cols.index("Rank")))
@@ -168,7 +172,7 @@ def create_grouped_leaderboard(selected_mwoz, selected_tau_airline, selected_tau
168
  def update_sort_state(current_state, clicked_column):
169
  """
170
  Update the sort state based on the clicked column.
171
- If the same column is clicked, toggle the sort order; otherwise, switch to the new column with ascending order.
172
  """
173
  if current_state is None:
174
  current_state = {"sort_by": clicked_column, "ascending": True}
@@ -255,7 +259,7 @@ def update_leaderboard(selected_mwoz, selected_tau_airline, selected_tau_retail,
255
  html_table = generate_html_table(df)
256
  return html_table
257
 
258
- with gr.Blocks(title="TD-EVAL Leaderboard") as demo:
259
  gr.Markdown("# 🏆 TD-EVAL Model Evaluation Leaderboard")
260
  gr.Markdown("""
261
  This leaderboard displays aggregated model performance across multiple evaluation metrics.
 
3
  import json
4
  import os
5
 
6
+ # Load external CSS from the file "styles.css"
7
+ with open("styles.css", "r") as f:
8
+ custom_css = f.read()
9
+
10
  def strip_timestamp(name):
11
  """Remove the timestamp portion from the model name."""
12
  parts = name.split('-')
 
161
  if sort_by in allowed_sort_cols:
162
  df = df.sort_values(sort_by, ascending=ascending)
163
 
164
+ # Reorder columns to have "Rank" as the first column.
165
  cols = df.columns.tolist()
166
  if "Rank" in cols:
167
  cols.insert(0, cols.pop(cols.index("Rank")))
 
172
  def update_sort_state(current_state, clicked_column):
173
  """
174
  Update the sort state based on the clicked column.
175
+ If the same column is clicked, toggle its sort order; otherwise, set the new column with ascending order.
176
  """
177
  if current_state is None:
178
  current_state = {"sort_by": clicked_column, "ascending": True}
 
259
  html_table = generate_html_table(df)
260
  return html_table
261
 
262
+ with gr.Blocks(css=custom_css, title="TD-EVAL Leaderboard") as demo:
263
  gr.Markdown("# 🏆 TD-EVAL Model Evaluation Leaderboard")
264
  gr.Markdown("""
265
  This leaderboard displays aggregated model performance across multiple evaluation metrics.
styles.css ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* General body style */
2
+ body {
3
+ font-family: Arial, sans-serif;
4
+ background-color: #f9f9f9;
5
+ margin: 20px;
6
+ }
7
+
8
+ /* Title styling for Markdown headers */
9
+ h1, h2, h3 {
10
+ color: #333;
11
+ }
12
+
13
+ /* Button styling */
14
+ button {
15
+ background-color: #007BFF;
16
+ color: #fff;
17
+ border: none;
18
+ padding: 8px 12px;
19
+ border-radius: 4px;
20
+ cursor: pointer;
21
+ font-size: 14px;
22
+ }
23
+
24
+ button:hover {
25
+ background-color: #0056b3;
26
+ }
27
+
28
+ /* Styling for checkboxes and labels */
29
+ .gradio-container .checkbox-container {
30
+ margin-right: 10px;
31
+ }
32
+
33
+ /* Table styling */
34
+ table {
35
+ width: 100%;
36
+ border-collapse: collapse;
37
+ margin-top: 20px;
38
+ }
39
+
40
+ th, td {
41
+ padding: 8px;
42
+ text-align: center;
43
+ border: 1px solid #ddd;
44
+ }
45
+
46
+ th {
47
+ background-color: #f2f2f2;
48
+ font-weight: bold;
49
+ }