Jack Monas commited on
Commit
346b9ec
·
1 Parent(s): 4f2d396
Files changed (1) hide show
  1. app.py +31 -34
app.py CHANGED
@@ -75,41 +75,38 @@ def scoring_section():
75
 
76
  leaderboard_df = pd.DataFrame(data)
77
 
78
- # Style the DataFrame for a cleaner look
79
- styled_df = leaderboard_df.style.set_table_styles([
80
- {
81
- "selector": "th",
82
- "props": [
83
- ("background-color", "#4C4C4C"),
84
- ("color", "#FFFFFF"),
85
- ("text-align", "center"),
86
- ("font-weight", "bold"),
87
- ("padding", "6px"),
88
- ]
89
- },
90
- {
91
- "selector": "td",
92
- "props": [
93
- ("text-align", "center"),
94
- ("padding", "6px"),
95
- ]
96
- },
97
- {
98
- "selector": "tr:nth-child(even)",
99
- "props": [
100
- ("background-color", "#F9F9F9"),
101
- ]
102
- },
103
- {
104
- "selector": "tr:nth-child(odd)",
105
- "props": [
106
- ("background-color", "#FFFFFF"),
107
- ]
108
- }
109
- ])
110
 
111
- # Convert to HTML without including the index
112
- st.write(styled_df.to_html(index=False), unsafe_allow_html=True)
113
 
114
 
115
 
 
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
 
112