idolezal commited on
Commit
ac4b2b4
β€’
1 Parent(s): b0f8b76

Added custom CSS

Browse files
Files changed (1) hide show
  1. app.py +50 -2
app.py CHANGED
@@ -87,7 +87,55 @@ def on_application_load():
87
  choices=leaderboard_server.submission_ids)
88
 
89
 
90
- with (gr.Blocks(theme=gr.themes.Soft(text_size=text_md), css="footer {visibility: hidden}") as main):
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
91
  with gr.Row():
92
  with gr.Row():
93
  gr.Markdown(HEADER_MARKDOWN)
@@ -96,7 +144,7 @@ with (gr.Blocks(theme=gr.themes.Soft(text_size=text_md), css="footer {visibility
96
  with gr.Tab('Leaderboard') as leaderboards_tab:
97
  gr.Markdown(LEADERBOARD_TAB_TITLE_MARKDOWN)
98
  results_table = gr.DataFrame(leaderboard_server.get_leaderboard(), interactive=False, label=None,
99
- visible=True)
100
 
101
  gr.Markdown(MORE_DETAILS_MARKDOWN)
102
  detail_dropdown = gr.Dropdown(choices=leaderboard_server.submission_ids, label="Select model",
 
87
  choices=leaderboard_server.submission_ids)
88
 
89
 
90
+ custom_css = """
91
+
92
+ footer {visibility: hidden}
93
+
94
+ #leaderboard-table tr:first-child th {
95
+ background-color: var(--table-even-background-fill);
96
+ }
97
+
98
+ #leaderboard-table th:first-child, #leaderboard-table td:first-child {
99
+ position: sticky;
100
+ left: 0;
101
+ z-index: 1;
102
+ background-color: inherit;
103
+ }
104
+
105
+ #leaderboard-table th:nth-child(2), #leaderboard-table td:nth-child(2) {
106
+ position: sticky;
107
+ left: var(--cell-width-0);
108
+ z-index: 1;
109
+ background-color: inherit;
110
+ }
111
+
112
+ #leaderboard-table th:nth-child(3), #leaderboard-table td:nth-child(3) {
113
+ position: sticky;
114
+ left: calc(var(--cell-width-0) + var(--cell-width-1));
115
+ z-index: 1;
116
+ background-color: inherit;
117
+ }
118
+
119
+ #leaderboard-table th:nth-child(4), #leaderboard-table td:nth-child(4) {
120
+ position: sticky;
121
+ left: calc(var(--cell-width-0) + var(--cell-width-1) + var(--cell-width-2));
122
+ z-index: 1;
123
+ background-color: inherit;
124
+ }
125
+
126
+ #leaderboard-table th:nth-child(5), #leaderboard-table td:nth-child(5) {
127
+ position: sticky;
128
+ left: calc(var(--cell-width-0) + var(--cell-width-1) + var(--cell-width-2) + var(--cell-width-3));
129
+ z-index: 1;
130
+ background-color: inherit;
131
+ border-right-width: 2px;
132
+ border-right-color: var(--border-color-primary);
133
+ }
134
+
135
+ """
136
+
137
+
138
+ with (gr.Blocks(theme=gr.themes.Soft(text_size=text_md), css=custom_css) as main):
139
  with gr.Row():
140
  with gr.Row():
141
  gr.Markdown(HEADER_MARKDOWN)
 
144
  with gr.Tab('Leaderboard') as leaderboards_tab:
145
  gr.Markdown(LEADERBOARD_TAB_TITLE_MARKDOWN)
146
  results_table = gr.DataFrame(leaderboard_server.get_leaderboard(), interactive=False, label=None,
147
+ visible=True, elem_id="leaderboard-table")
148
 
149
  gr.Markdown(MORE_DETAILS_MARKDOWN)
150
  detail_dropdown = gr.Dropdown(choices=leaderboard_server.submission_ids, label="Select model",