Jack Monas commited on
Commit
015e45c
·
1 Parent(s): a8e7097
Files changed (1) hide show
  1. app.py +25 -17
app.py CHANGED
@@ -64,6 +64,7 @@ def scoring_section():
64
  "respective Hugging Face submission servers. Below is a preview of the overall leaderboard format:"
65
  )
66
 
 
67
  data = {
68
  "Rank": [1, 2, 3],
69
  "Team Name": ["Team Alpha", "Team Beta", "Team Gamma"],
@@ -75,37 +76,44 @@ def scoring_section():
75
 
76
  leaderboard_df = pd.DataFrame(data)
77
 
78
- # Define custom CSS for a cleaner table
79
  table_css = """
80
  <style>
81
- table {
82
  border-collapse: collapse;
83
- margin: 10px 0;
84
- font-size: 1em;
85
  width: 100%;
 
 
 
86
  }
87
- th, td {
88
- border: 1px solid #ddd;
 
89
  padding: 8px;
90
  text-align: center;
 
91
  }
92
- th {
93
- background-color: #4C4C4C;
94
- color: #ffffff;
 
95
  }
96
- tr:nth-child(even) {
97
- background-color: #f9f9f9;
98
  }
99
- tr:nth-child(odd) {
100
- background-color: #ffffff;
101
  }
102
  </style>
103
  """
104
 
105
- # Convert the DataFrame to HTML without showing the index
106
- styled_html = leaderboard_df.to_html(index=False)
107
-
108
- # Combine the CSS with the HTML table
 
 
 
109
  st.markdown(table_css + styled_html, unsafe_allow_html=True)
110
 
111
 
 
64
  "respective Hugging Face submission servers. Below is a preview of the overall leaderboard format:"
65
  )
66
 
67
+ # Sample data
68
  data = {
69
  "Rank": [1, 2, 3],
70
  "Team Name": ["Team Alpha", "Team Beta", "Team Gamma"],
 
76
 
77
  leaderboard_df = pd.DataFrame(data)
78
 
79
+ # Custom CSS for a dark theme table
80
  table_css = """
81
  <style>
82
+ .dark-table {
83
  border-collapse: collapse;
 
 
84
  width: 100%;
85
+ font-size: 1em;
86
+ margin: 10px 0;
87
+ color: #dddddd; /* Light text for dark background */
88
  }
89
+ .dark-table th {
90
+ background-color: #333333; /* Dark header background */
91
+ color: #ffffff; /* White text for contrast */
92
  padding: 8px;
93
  text-align: center;
94
+ font-weight: bold;
95
  }
96
+ .dark-table td {
97
+ border: 1px solid #444444;
98
+ padding: 8px;
99
+ text-align: center;
100
  }
101
+ .dark-table tr:nth-child(even) {
102
+ background-color: #2b2b2b; /* Slightly lighter row for contrast */
103
  }
104
+ .dark-table tr:nth-child(odd) {
105
+ background-color: #1f1f1f;
106
  }
107
  </style>
108
  """
109
 
110
+ # Convert DataFrame to HTML with a custom CSS class
111
+ styled_html = leaderboard_df.to_html(
112
+ index=False,
113
+ classes="dark-table" # Use the .dark-table CSS
114
+ )
115
+
116
+ # Render the CSS + table
117
  st.markdown(table_css + styled_html, unsafe_allow_html=True)
118
 
119