adjust column width settings
Browse files- app.py +4 -2
- static/css/style.css +43 -10
app.py
CHANGED
|
@@ -78,10 +78,11 @@ with gr.Blocks() as block:
|
|
| 78 |
data_component = gr.Dataframe(
|
| 79 |
value=initial_data,
|
| 80 |
headers=initial_headers,
|
| 81 |
-
datatype=["number"
|
| 82 |
interactive=False,
|
| 83 |
elem_classes="custom-dataframe",
|
| 84 |
max_height=2400,
|
|
|
|
| 85 |
)
|
| 86 |
|
| 87 |
def update_table_and_caption(table_type, super_group, model_group):
|
|
@@ -96,8 +97,9 @@ with gr.Blocks() as block:
|
|
| 96 |
gr.Dataframe(
|
| 97 |
value=data,
|
| 98 |
headers=headers,
|
| 99 |
-
datatype=["number"
|
| 100 |
interactive=False,
|
|
|
|
| 101 |
),
|
| 102 |
caption,
|
| 103 |
f"<style>{base_css}\n{table_css}</style>"
|
|
|
|
| 78 |
data_component = gr.Dataframe(
|
| 79 |
value=initial_data,
|
| 80 |
headers=initial_headers,
|
| 81 |
+
datatype=["number", "html"] + ["number"] * (len(initial_headers) - 2),
|
| 82 |
interactive=False,
|
| 83 |
elem_classes="custom-dataframe",
|
| 84 |
max_height=2400,
|
| 85 |
+
column_widths=["80px", "220px"] + ["140px"] * (len(initial_headers) - 2),
|
| 86 |
)
|
| 87 |
|
| 88 |
def update_table_and_caption(table_type, super_group, model_group):
|
|
|
|
| 97 |
gr.Dataframe(
|
| 98 |
value=data,
|
| 99 |
headers=headers,
|
| 100 |
+
datatype=["number", "html"] + ["number"] * (len(headers) - 2),
|
| 101 |
interactive=False,
|
| 102 |
+
column_widths=["80px", "220px"] + ["140px"] * (len(headers) - 2),
|
| 103 |
),
|
| 104 |
caption,
|
| 105 |
f"<style>{base_css}\n{table_css}</style>"
|
static/css/style.css
CHANGED
|
@@ -46,23 +46,56 @@
|
|
| 46 |
color: var(--text-color);
|
| 47 |
}
|
| 48 |
|
| 49 |
-
|
| 50 |
-
.custom-dataframe
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
max-width: 60px !important;
|
| 54 |
-
text-align: center !important;
|
| 55 |
white-space: nowrap !important;
|
| 56 |
-
|
|
|
|
| 57 |
}
|
| 58 |
|
|
|
|
|
|
|
| 59 |
.custom-dataframe th:first-child {
|
| 60 |
-
|
|
|
|
|
|
|
|
|
|
| 61 |
}
|
| 62 |
|
| 63 |
-
|
|
|
|
|
|
|
|
|
|
| 64 |
min-width: 220px !important;
|
| 65 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 66 |
}
|
| 67 |
|
| 68 |
.custom-dataframe a {
|
|
|
|
| 46 |
color: var(--text-color);
|
| 47 |
}
|
| 48 |
|
| 49 |
+
/* Base styles for all table cells and headers */
|
| 50 |
+
.custom-dataframe td,
|
| 51 |
+
.custom-dataframe th {
|
| 52 |
+
padding: 8px !important;
|
|
|
|
|
|
|
| 53 |
white-space: nowrap !important;
|
| 54 |
+
overflow: hidden !important;
|
| 55 |
+
text-overflow: ellipsis !important;
|
| 56 |
}
|
| 57 |
|
| 58 |
+
/* Rank column */
|
| 59 |
+
.custom-dataframe td:first-child,
|
| 60 |
.custom-dataframe th:first-child {
|
| 61 |
+
width: 80px !important;
|
| 62 |
+
min-width: 80px !important;
|
| 63 |
+
max-width: 80px !important;
|
| 64 |
+
text-align: center !important;
|
| 65 |
}
|
| 66 |
|
| 67 |
+
/* Models column */
|
| 68 |
+
.custom-dataframe td:nth-child(2),
|
| 69 |
+
.custom-dataframe th:nth-child(2) {
|
| 70 |
+
width: 220px !important;
|
| 71 |
min-width: 220px !important;
|
| 72 |
+
max-width: 220px !important;
|
| 73 |
+
}
|
| 74 |
+
|
| 75 |
+
/* Overall, Core, Open-ended columns */
|
| 76 |
+
.custom-dataframe td:nth-child(n+3):nth-child(-n+5),
|
| 77 |
+
.custom-dataframe th:nth-child(n+3):nth-child(-n+5) {
|
| 78 |
+
width: 140px !important;
|
| 79 |
+
min-width: 140px !important;
|
| 80 |
+
max-width: 140px !important;
|
| 81 |
+
text-align: right !important;
|
| 82 |
+
}
|
| 83 |
+
|
| 84 |
+
/* Dimension columns */
|
| 85 |
+
.custom-dataframe td:nth-child(n+6),
|
| 86 |
+
.custom-dataframe th:nth-child(n+6) {
|
| 87 |
+
width: 140px !important;
|
| 88 |
+
min-width: 140px !important;
|
| 89 |
+
max-width: 140px !important;
|
| 90 |
+
text-align: right !important;
|
| 91 |
+
}
|
| 92 |
+
|
| 93 |
+
/* Fix header text wrapping */
|
| 94 |
+
.custom-dataframe th {
|
| 95 |
+
height: auto !important;
|
| 96 |
+
line-height: 1.2 !important;
|
| 97 |
+
white-space: normal !important; /* Allow header text to wrap */
|
| 98 |
+
vertical-align: bottom !important;
|
| 99 |
}
|
| 100 |
|
| 101 |
.custom-dataframe a {
|