Spaces:
Running
Running
Commit ·
c4f95f5
1
Parent(s): 37b185d
UI improvements: hide status message, reorder layout, adopt low-saturation colors from homepage
Browse files- app.py +17 -14
- src/styling.py +98 -50
app.py
CHANGED
|
@@ -25,7 +25,8 @@ def reload_data():
|
|
| 25 |
ax.text(0.5, 0.5, msg, ha="center", va="center")
|
| 26 |
ax.axis("off")
|
| 27 |
placeholder_html = "<div class='placeholder'>No data available</div>"
|
| 28 |
-
|
|
|
|
| 29 |
gr.update(choices=["All"], value="All"), \
|
| 30 |
gr.update(choices=["All"], value="All"), \
|
| 31 |
placeholder_html, dummy_fig
|
|
@@ -50,7 +51,8 @@ def reload_data():
|
|
| 50 |
radar_fig = radar_plotter.create_radar_chart()
|
| 51 |
html_table = dataframe_to_html(table_df)
|
| 52 |
|
| 53 |
-
|
|
|
|
| 54 |
gr.update(choices=open_source_choices, value="All"), \
|
| 55 |
gr.update(choices=year_choices, value="All"), \
|
| 56 |
gr.update(choices=category_choices, value="All"), \
|
|
@@ -83,7 +85,7 @@ def create_comparison_plot_wrapper(model_filter, open_source_filter, year_filter
|
|
| 83 |
year_filter, category_filter,
|
| 84 |
clean_metric, plot_sort_mode)
|
| 85 |
|
| 86 |
-
# Define CSS
|
| 87 |
academic_css = get_academic_css()
|
| 88 |
|
| 89 |
with gr.Blocks(css=academic_css) as demo:
|
|
@@ -97,7 +99,8 @@ with gr.Blocks(css=academic_css) as demo:
|
|
| 97 |
elem_id="title"
|
| 98 |
)
|
| 99 |
|
| 100 |
-
|
|
|
|
| 101 |
|
| 102 |
with gr.Row():
|
| 103 |
with gr.Column(scale=2):
|
|
@@ -162,25 +165,23 @@ with gr.Blocks(css=academic_css) as demo:
|
|
| 162 |
reload_button = gr.Button("🔄 Reload Data", variant="secondary", size="sm")
|
| 163 |
update_button = gr.Button("✅ Update Leaderboard", variant="primary", size="sm")
|
| 164 |
|
| 165 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 166 |
with gr.Row():
|
| 167 |
-
with gr.Column(scale=2):
|
| 168 |
-
leaderboard_html = gr.HTML(
|
| 169 |
-
label="Leaderboard Table",
|
| 170 |
-
value="<div class='placeholder'>Leaderboard will be displayed here...</div>"
|
| 171 |
-
)
|
| 172 |
with gr.Column(scale=1):
|
| 173 |
radar_plot = gr.Plot(label="Performance Radar (8 metrics)", format="png")
|
| 174 |
-
|
| 175 |
-
with gr.Row():
|
| 176 |
-
with gr.Column(scale=2):
|
| 177 |
plot_metric_radio = gr.Radio(
|
| 178 |
label="Select Metric for Comparison Plot",
|
| 179 |
choices=metric_choices,
|
| 180 |
value=DEFAULT_METRIC,
|
| 181 |
interactive=True,
|
| 182 |
)
|
| 183 |
-
with gr.Column(scale=1):
|
| 184 |
plot_sort_radio = gr.Radio(
|
| 185 |
label="Plot Sort Order",
|
| 186 |
choices=["Ascending (low → high)", "Descending (high → low)"],
|
|
@@ -189,8 +190,10 @@ with gr.Blocks(css=academic_css) as demo:
|
|
| 189 |
)
|
| 190 |
plot_update_button = gr.Button("📊 Generate Comparison Plot", variant="primary", size="sm")
|
| 191 |
|
|
|
|
| 192 |
comparison_plot = gr.Plot(label="Model Comparison Visualization", format="png")
|
| 193 |
|
|
|
|
| 194 |
reload_button.click(
|
| 195 |
fn=reload_data,
|
| 196 |
inputs=[],
|
|
|
|
| 25 |
ax.text(0.5, 0.5, msg, ha="center", va="center")
|
| 26 |
ax.axis("off")
|
| 27 |
placeholder_html = "<div class='placeholder'>No data available</div>"
|
| 28 |
+
# Return empty string for hidden status
|
| 29 |
+
return "", gr.update(choices=["All"], value="All"), \
|
| 30 |
gr.update(choices=["All"], value="All"), \
|
| 31 |
gr.update(choices=["All"], value="All"), \
|
| 32 |
placeholder_html, dummy_fig
|
|
|
|
| 51 |
radar_fig = radar_plotter.create_radar_chart()
|
| 52 |
html_table = dataframe_to_html(table_df)
|
| 53 |
|
| 54 |
+
# Return empty string for hidden status
|
| 55 |
+
return "", \
|
| 56 |
gr.update(choices=open_source_choices, value="All"), \
|
| 57 |
gr.update(choices=year_choices, value="All"), \
|
| 58 |
gr.update(choices=category_choices, value="All"), \
|
|
|
|
| 85 |
year_filter, category_filter,
|
| 86 |
clean_metric, plot_sort_mode)
|
| 87 |
|
| 88 |
+
# Define CSS
|
| 89 |
academic_css = get_academic_css()
|
| 90 |
|
| 91 |
with gr.Blocks(css=academic_css) as demo:
|
|
|
|
| 99 |
elem_id="title"
|
| 100 |
)
|
| 101 |
|
| 102 |
+
# Hidden status box (no longer displayed)
|
| 103 |
+
status_box = gr.Markdown(visible=False)
|
| 104 |
|
| 105 |
with gr.Row():
|
| 106 |
with gr.Column(scale=2):
|
|
|
|
| 165 |
reload_button = gr.Button("🔄 Reload Data", variant="secondary", size="sm")
|
| 166 |
update_button = gr.Button("✅ Update Leaderboard", variant="primary", size="sm")
|
| 167 |
|
| 168 |
+
# Row 1: Leaderboard table (full width)
|
| 169 |
+
leaderboard_html = gr.HTML(
|
| 170 |
+
label="Leaderboard Table",
|
| 171 |
+
value="<div class='placeholder'>Leaderboard will be displayed here...</div>"
|
| 172 |
+
)
|
| 173 |
+
|
| 174 |
+
# Row 2: Radar chart (left) and comparison plot controls (right)
|
| 175 |
with gr.Row():
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 176 |
with gr.Column(scale=1):
|
| 177 |
radar_plot = gr.Plot(label="Performance Radar (8 metrics)", format="png")
|
| 178 |
+
with gr.Column(scale=1):
|
|
|
|
|
|
|
| 179 |
plot_metric_radio = gr.Radio(
|
| 180 |
label="Select Metric for Comparison Plot",
|
| 181 |
choices=metric_choices,
|
| 182 |
value=DEFAULT_METRIC,
|
| 183 |
interactive=True,
|
| 184 |
)
|
|
|
|
| 185 |
plot_sort_radio = gr.Radio(
|
| 186 |
label="Plot Sort Order",
|
| 187 |
choices=["Ascending (low → high)", "Descending (high → low)"],
|
|
|
|
| 190 |
)
|
| 191 |
plot_update_button = gr.Button("📊 Generate Comparison Plot", variant="primary", size="sm")
|
| 192 |
|
| 193 |
+
# Row 3: Comparison plot (full width)
|
| 194 |
comparison_plot = gr.Plot(label="Model Comparison Visualization", format="png")
|
| 195 |
|
| 196 |
+
# Event bindings
|
| 197 |
reload_button.click(
|
| 198 |
fn=reload_data,
|
| 199 |
inputs=[],
|
src/styling.py
CHANGED
|
@@ -5,66 +5,64 @@ def get_academic_css() -> str:
|
|
| 5 |
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');
|
| 6 |
|
| 7 |
:root {
|
| 8 |
-
--primary: #
|
| 9 |
-
--primary-dark: #
|
| 10 |
-
--accent: #
|
| 11 |
-
--text-dark: #
|
| 12 |
-
--text-
|
| 13 |
-
--
|
| 14 |
-
--
|
| 15 |
-
--
|
| 16 |
-
--
|
| 17 |
-
--
|
| 18 |
-
--
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
}
|
| 20 |
|
| 21 |
@media (prefers-color-scheme: dark) {
|
| 22 |
:root {
|
| 23 |
-
--text-
|
| 24 |
-
--
|
|
|
|
| 25 |
--border: #3a4a5a;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
}
|
| 27 |
body {
|
| 28 |
-
background-color:
|
| 29 |
-
color: var(--text-light);
|
| 30 |
-
}
|
| 31 |
-
.gradio-container {
|
| 32 |
-
background-color: var(--bg-dark) !important;
|
| 33 |
-
}
|
| 34 |
-
.leaderboard-table td {
|
| 35 |
-
border-bottom-color: var(--border);
|
| 36 |
-
}
|
| 37 |
-
.leaderboard-table tr:nth-child(even) {
|
| 38 |
-
background-color: #2a3745;
|
| 39 |
-
}
|
| 40 |
-
.leaderboard-table tr:hover {
|
| 41 |
-
background-color: #354454;
|
| 42 |
-
}
|
| 43 |
-
.leaderboard-table th {
|
| 44 |
-
background: linear-gradient(135deg, #3a4a5a 0%, #4a5a6a 100%);
|
| 45 |
-
}
|
| 46 |
-
}
|
| 47 |
-
|
| 48 |
-
@media (prefers-color-scheme: light) {
|
| 49 |
-
:root {
|
| 50 |
-
--text-primary: var(--text-dark);
|
| 51 |
-
--bg-primary: var(--bg-light);
|
| 52 |
-
}
|
| 53 |
-
body {
|
| 54 |
-
background-color: var(--bg-light);
|
| 55 |
color: var(--text-dark);
|
| 56 |
}
|
| 57 |
.gradio-container {
|
| 58 |
-
background-color:
|
| 59 |
}
|
| 60 |
}
|
| 61 |
|
| 62 |
body {
|
| 63 |
font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
|
|
|
|
|
|
|
| 64 |
}
|
| 65 |
|
| 66 |
.gradio-container {
|
| 67 |
max-width: 1400px !important;
|
|
|
|
| 68 |
}
|
| 69 |
|
| 70 |
h1 {
|
|
@@ -73,7 +71,7 @@ def get_academic_css() -> str:
|
|
| 73 |
}
|
| 74 |
|
| 75 |
.subtitle {
|
| 76 |
-
color: var(--text-
|
| 77 |
font-size: 1.1rem;
|
| 78 |
margin-top: 0.5rem;
|
| 79 |
opacity: 0.8;
|
|
@@ -83,46 +81,93 @@ def get_academic_css() -> str:
|
|
| 83 |
font-size: 1.5em;
|
| 84 |
}
|
| 85 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 86 |
.leaderboard-table {
|
| 87 |
width: 100%;
|
| 88 |
border-collapse: collapse;
|
| 89 |
font-size: 0.9rem;
|
| 90 |
margin-top: 1rem;
|
|
|
|
|
|
|
| 91 |
}
|
| 92 |
|
| 93 |
.leaderboard-table th {
|
| 94 |
-
background:
|
| 95 |
color: white;
|
| 96 |
padding: 12px 8px;
|
| 97 |
text-align: center;
|
| 98 |
font-weight: 600;
|
| 99 |
position: sticky;
|
| 100 |
top: 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 101 |
}
|
| 102 |
|
| 103 |
.leaderboard-table td {
|
| 104 |
padding: 10px 8px;
|
| 105 |
text-align: center;
|
| 106 |
-
border-bottom: 1px solid var(--border);
|
| 107 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 108 |
}
|
| 109 |
|
| 110 |
.leaderboard-table tr:nth-child(even) {
|
| 111 |
-
background-color:
|
| 112 |
}
|
| 113 |
|
| 114 |
.leaderboard-table tr:hover {
|
| 115 |
-
background-color:
|
| 116 |
}
|
| 117 |
|
|
|
|
| 118 |
.rank-1 { background: linear-gradient(135deg, #ffd700 0%, #ffed4a 100%) !important; font-weight: bold; }
|
| 119 |
.rank-2 { background: linear-gradient(135deg, #c0c0c0 0%, #e5e7eb 100%) !important; font-weight: bold; }
|
| 120 |
.rank-3 { background: linear-gradient(135deg, #cd7f32 0%, #fdba74 100%) !important; font-weight: bold; }
|
| 121 |
|
|
|
|
| 122 |
.best-score {
|
| 123 |
-
color: #2c7a7b;
|
| 124 |
font-weight: 700;
|
| 125 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 126 |
}
|
| 127 |
|
| 128 |
.category-tag {
|
|
@@ -136,6 +181,7 @@ def get_academic_css() -> str:
|
|
| 136 |
.cat-onehot { background: #d1fae5; color: #065f46; }
|
| 137 |
.cat-camera { background: #fef3c7; color: #92400e; }
|
| 138 |
|
|
|
|
| 139 |
.leaderboard-table a {
|
| 140 |
color: var(--primary);
|
| 141 |
text-decoration: none;
|
|
@@ -145,14 +191,16 @@ def get_academic_css() -> str:
|
|
| 145 |
opacity: 0.7;
|
| 146 |
}
|
| 147 |
|
|
|
|
| 148 |
button.primary {
|
| 149 |
background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%) !important;
|
| 150 |
color: white !important;
|
| 151 |
border: none;
|
| 152 |
}
|
| 153 |
|
|
|
|
| 154 |
.status-success { color: var(--success); }
|
| 155 |
-
.status-error { color: var(--
|
| 156 |
"""
|
| 157 |
|
| 158 |
def dataframe_to_html(df: pd.DataFrame) -> str:
|
|
|
|
| 5 |
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');
|
| 6 |
|
| 7 |
:root {
|
| 8 |
+
--primary: #2563eb;
|
| 9 |
+
--primary-dark: #1d4ed8;
|
| 10 |
+
--accent: #06b6d4;
|
| 11 |
+
--text-dark: #1a1a1a;
|
| 12 |
+
--text-gray: #4a4a4a;
|
| 13 |
+
--text-light: #666666;
|
| 14 |
+
--border: #e5e5e5;
|
| 15 |
+
--bg-light: #f8f9fa;
|
| 16 |
+
--white: #ffffff;
|
| 17 |
+
--success: #10b981;
|
| 18 |
+
--danger: #ef4444;
|
| 19 |
+
|
| 20 |
+
/* Low saturation table colors */
|
| 21 |
+
--table-header: #64748b;
|
| 22 |
+
--table-header-light: #94a3b8;
|
| 23 |
+
--table-border: #cbd5e0;
|
| 24 |
+
--table-bg-alt: #f8fafc;
|
| 25 |
+
--table-highlight: #f1f5f9;
|
| 26 |
+
--best-score-bg: #e6fffa;
|
| 27 |
+
--best-score-color: #2c7a7b;
|
| 28 |
+
--category-bg: #e2e8f0;
|
| 29 |
+
--category-color: #475569;
|
| 30 |
}
|
| 31 |
|
| 32 |
@media (prefers-color-scheme: dark) {
|
| 33 |
:root {
|
| 34 |
+
--text-dark: #ecf0f1;
|
| 35 |
+
--text-gray: #b0b0b0;
|
| 36 |
+
--bg-light: #1e2b38;
|
| 37 |
--border: #3a4a5a;
|
| 38 |
+
--table-header: #4a5a6a;
|
| 39 |
+
--table-header-light: #5a6a7a;
|
| 40 |
+
--table-border: #3a4a5a;
|
| 41 |
+
--table-bg-alt: #2a3745;
|
| 42 |
+
--table-highlight: #354454;
|
| 43 |
+
--best-score-bg: #1a3a3a;
|
| 44 |
+
--best-score-color: #7fc9c9;
|
| 45 |
+
--category-bg: #3a4a5a;
|
| 46 |
+
--category-color: #cbd5e0;
|
| 47 |
}
|
| 48 |
body {
|
| 49 |
+
background-color: #1a2632;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 50 |
color: var(--text-dark);
|
| 51 |
}
|
| 52 |
.gradio-container {
|
| 53 |
+
background-color: #1a2632 !important;
|
| 54 |
}
|
| 55 |
}
|
| 56 |
|
| 57 |
body {
|
| 58 |
font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
|
| 59 |
+
background-color: var(--bg-light);
|
| 60 |
+
color: var(--text-dark);
|
| 61 |
}
|
| 62 |
|
| 63 |
.gradio-container {
|
| 64 |
max-width: 1400px !important;
|
| 65 |
+
background-color: var(--bg-light) !important;
|
| 66 |
}
|
| 67 |
|
| 68 |
h1 {
|
|
|
|
| 71 |
}
|
| 72 |
|
| 73 |
.subtitle {
|
| 74 |
+
color: var(--text-gray);
|
| 75 |
font-size: 1.1rem;
|
| 76 |
margin-top: 0.5rem;
|
| 77 |
opacity: 0.8;
|
|
|
|
| 81 |
font-size: 1.5em;
|
| 82 |
}
|
| 83 |
|
| 84 |
+
/* Tables - Low saturation, no rounded corners */
|
| 85 |
+
.table-wrapper {
|
| 86 |
+
margin: 1.5rem 0;
|
| 87 |
+
overflow-x: auto;
|
| 88 |
+
}
|
| 89 |
+
|
| 90 |
.leaderboard-table {
|
| 91 |
width: 100%;
|
| 92 |
border-collapse: collapse;
|
| 93 |
font-size: 0.9rem;
|
| 94 |
margin-top: 1rem;
|
| 95 |
+
border: 1px solid var(--table-border);
|
| 96 |
+
background-color: var(--white);
|
| 97 |
}
|
| 98 |
|
| 99 |
.leaderboard-table th {
|
| 100 |
+
background: var(--table-header);
|
| 101 |
color: white;
|
| 102 |
padding: 12px 8px;
|
| 103 |
text-align: center;
|
| 104 |
font-weight: 600;
|
| 105 |
position: sticky;
|
| 106 |
top: 0;
|
| 107 |
+
border-right: 1px solid rgba(255,255,255,0.15);
|
| 108 |
+
}
|
| 109 |
+
|
| 110 |
+
.leaderboard-table th:last-child {
|
| 111 |
+
border-right: none;
|
| 112 |
}
|
| 113 |
|
| 114 |
.leaderboard-table td {
|
| 115 |
padding: 10px 8px;
|
| 116 |
text-align: center;
|
| 117 |
+
border-bottom: 1px solid var(--table-border);
|
| 118 |
+
border-right: 1px solid var(--table-border);
|
| 119 |
+
color: var(--text-gray);
|
| 120 |
+
}
|
| 121 |
+
|
| 122 |
+
.leaderboard-table td:last-child {
|
| 123 |
+
border-right: none;
|
| 124 |
}
|
| 125 |
|
| 126 |
.leaderboard-table tr:nth-child(even) {
|
| 127 |
+
background-color: var(--table-bg-alt);
|
| 128 |
}
|
| 129 |
|
| 130 |
.leaderboard-table tr:hover {
|
| 131 |
+
background-color: var(--table-highlight);
|
| 132 |
}
|
| 133 |
|
| 134 |
+
/* Rank styles */
|
| 135 |
.rank-1 { background: linear-gradient(135deg, #ffd700 0%, #ffed4a 100%) !important; font-weight: bold; }
|
| 136 |
.rank-2 { background: linear-gradient(135deg, #c0c0c0 0%, #e5e7eb 100%) !important; font-weight: bold; }
|
| 137 |
.rank-3 { background: linear-gradient(135deg, #cd7f32 0%, #fdba74 100%) !important; font-weight: bold; }
|
| 138 |
|
| 139 |
+
/* Best score highlight */
|
| 140 |
.best-score {
|
|
|
|
| 141 |
font-weight: 700;
|
| 142 |
+
color: var(--best-score-color);
|
| 143 |
+
background: var(--best-score-bg) !important;
|
| 144 |
+
}
|
| 145 |
+
|
| 146 |
+
/* Category row (for group headers) */
|
| 147 |
+
.category-row {
|
| 148 |
+
background: var(--category-bg) !important;
|
| 149 |
+
font-weight: 600;
|
| 150 |
+
color: var(--category-color);
|
| 151 |
+
text-align: left;
|
| 152 |
+
font-size: 0.85rem;
|
| 153 |
+
}
|
| 154 |
+
|
| 155 |
+
.category-row td {
|
| 156 |
+
padding: 10px 15px;
|
| 157 |
+
color: var(--category-color);
|
| 158 |
+
border-bottom: 2px solid var(--table-border);
|
| 159 |
+
}
|
| 160 |
+
|
| 161 |
+
.check {
|
| 162 |
+
color: var(--success);
|
| 163 |
+
font-weight: bold;
|
| 164 |
+
font-size: 1.2em;
|
| 165 |
+
}
|
| 166 |
+
|
| 167 |
+
.cross {
|
| 168 |
+
color: var(--danger);
|
| 169 |
+
font-weight: bold;
|
| 170 |
+
font-size: 1.2em;
|
| 171 |
}
|
| 172 |
|
| 173 |
.category-tag {
|
|
|
|
| 181 |
.cat-onehot { background: #d1fae5; color: #065f46; }
|
| 182 |
.cat-camera { background: #fef3c7; color: #92400e; }
|
| 183 |
|
| 184 |
+
/* Links */
|
| 185 |
.leaderboard-table a {
|
| 186 |
color: var(--primary);
|
| 187 |
text-decoration: none;
|
|
|
|
| 191 |
opacity: 0.7;
|
| 192 |
}
|
| 193 |
|
| 194 |
+
/* Buttons */
|
| 195 |
button.primary {
|
| 196 |
background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%) !important;
|
| 197 |
color: white !important;
|
| 198 |
border: none;
|
| 199 |
}
|
| 200 |
|
| 201 |
+
/* Status indicators (hidden) */
|
| 202 |
.status-success { color: var(--success); }
|
| 203 |
+
.status-error { color: var(--danger); }
|
| 204 |
"""
|
| 205 |
|
| 206 |
def dataframe_to_html(df: pd.DataFrame) -> str:
|