Spaces:
Running
Running
Commit
·
db3ced7
1
Parent(s):
c963b80
feat - add tooltips
Browse files- app/backend/data_page.py +32 -8
- app/backend/multi_header_util.py +70 -15
- requirements.txt +1 -1
app/backend/data_page.py
CHANGED
@@ -46,8 +46,6 @@ def get_closed_dataset():
|
|
46 |
return closed_list
|
47 |
|
48 |
|
49 |
-
|
50 |
-
|
51 |
def convert_df_to_csv(df):
|
52 |
output = io.StringIO()
|
53 |
df.to_csv(output, index=False)
|
@@ -123,7 +121,6 @@ def table_only_css():
|
|
123 |
height: 0px;
|
124 |
|
125 |
}
|
126 |
-
</style>
|
127 |
""", unsafe_allow_html=True)
|
128 |
|
129 |
|
@@ -203,17 +200,20 @@ def table_area(group_name, grid_state, data_engine=None, df=None):
|
|
203 |
# Model Name Cell
|
204 |
".a-cell": {
|
205 |
"display": "inline-block",
|
206 |
-
"white-space": "nowrap",
|
207 |
-
"overflow": "hidden",
|
208 |
-
"text-overflow": "ellipsis",
|
209 |
"width": "100%",
|
210 |
"min-width": "0"
|
211 |
},
|
212 |
# Header
|
|
|
|
|
|
|
213 |
".multi-line-header": {
|
214 |
"text-overflow": "clip",
|
215 |
"overflow": "visible",
|
216 |
-
"white-space": "
|
217 |
"height": "auto",
|
218 |
"font-family": 'Arial',
|
219 |
"font-size": "14px",
|
@@ -232,7 +232,7 @@ def table_area(group_name, grid_state, data_engine=None, df=None):
|
|
232 |
"font-weight": "bold",
|
233 |
"padding": "10px",
|
234 |
"text-align": "left",
|
235 |
-
"width":"
|
236 |
},
|
237 |
".custom-cell-style": {
|
238 |
"font-size": "14px",
|
@@ -254,7 +254,31 @@ def table_area(group_name, grid_state, data_engine=None, df=None):
|
|
254 |
"font-size": "14px",
|
255 |
|
256 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
257 |
|
|
|
258 |
}
|
259 |
|
260 |
grid = AgGrid(
|
|
|
46 |
return closed_list
|
47 |
|
48 |
|
|
|
|
|
49 |
def convert_df_to_csv(df):
|
50 |
output = io.StringIO()
|
51 |
df.to_csv(output, index=False)
|
|
|
121 |
height: 0px;
|
122 |
|
123 |
}
|
|
|
124 |
""", unsafe_allow_html=True)
|
125 |
|
126 |
|
|
|
200 |
# Model Name Cell
|
201 |
".a-cell": {
|
202 |
"display": "inline-block",
|
203 |
+
# "white-space": "nowrap",
|
204 |
+
# "overflow": "hidden",
|
205 |
+
# "text-overflow": "ellipsis",
|
206 |
"width": "100%",
|
207 |
"min-width": "0"
|
208 |
},
|
209 |
# Header
|
210 |
+
".ag-header":{
|
211 |
+
"overflow": "visible !important",
|
212 |
+
},
|
213 |
".multi-line-header": {
|
214 |
"text-overflow": "clip",
|
215 |
"overflow": "visible",
|
216 |
+
"white-space": "nowrap",
|
217 |
"height": "auto",
|
218 |
"font-family": 'Arial',
|
219 |
"font-size": "14px",
|
|
|
232 |
"font-weight": "bold",
|
233 |
"padding": "10px",
|
234 |
"text-align": "left",
|
235 |
+
# "width": "100%"
|
236 |
},
|
237 |
".custom-cell-style": {
|
238 |
"font-size": "14px",
|
|
|
254 |
"font-size": "14px",
|
255 |
|
256 |
}
|
257 |
+
# , ".link-header-component": {
|
258 |
+
# "overflow": "visible !important",
|
259 |
+
# "min-width": "auto !important",
|
260 |
+
# }
|
261 |
+
#
|
262 |
+
# , ".link-header-component > span ": {
|
263 |
+
# "overflow": "visible !important",
|
264 |
+
# "white-space": "nowrap !important",
|
265 |
+
# "text-overflow": "unset !important",
|
266 |
+
# "flex": "unset !important",
|
267 |
+
# },
|
268 |
+
# ,".custom-link-header-style": {
|
269 |
+
#
|
270 |
+
# "display": "inline-block",
|
271 |
+
# }
|
272 |
+
,".ag-header-cell-text":{
|
273 |
+
"overflow": "visible !important",
|
274 |
+
"width":"fit-content"
|
275 |
+
|
276 |
+
}
|
277 |
+
,".ag-header-cell-label":{
|
278 |
+
"overflow": "visible !important",
|
279 |
+
"width": "fit-content"
|
280 |
|
281 |
+
}
|
282 |
}
|
283 |
|
284 |
grid = AgGrid(
|
app/backend/multi_header_util.py
CHANGED
@@ -4,11 +4,11 @@ handle multi_header options
|
|
4 |
from st_aggrid import JsCode
|
5 |
from streamlit_theme import st_theme
|
6 |
|
7 |
-
|
8 |
HEADER_STYLE = {'fontSize': '18px'}
|
9 |
CELL_STYLE = {'fontSize': '18px'}
|
10 |
LINK = ' https://huggingface.co/datasets/embedding-benchmark/'
|
11 |
|
|
|
12 |
def get_dataset_url_name(field_name):
|
13 |
"""Convert field name to proper URL format for closed datasets"""
|
14 |
# Handle field names like "ClosedDataset 2 (German Legal Sentences)"
|
@@ -25,6 +25,7 @@ def get_dataset_url_name(field_name):
|
|
25 |
# Return original field_name for open datasets
|
26 |
return field_name
|
27 |
|
|
|
28 |
def mutil_header_options(column_list: list, avg_column: str, is_section: bool):
|
29 |
"""
|
30 |
get mutil_header_options - 优化版本,减少组件实例化
|
@@ -50,13 +51,16 @@ def mutil_header_options(column_list: list, avg_column: str, is_section: bool):
|
|
50 |
mutil_column_list = [column for column in column_list if
|
51 |
column not in (avg_column, "Closed average", "Open average")]
|
52 |
close_group_list = list(filter(lambda x: x.startswith('_') or x.startswith("ClosedDataset "), mutil_column_list))
|
53 |
-
open_group_list = list(
|
54 |
-
|
55 |
-
theme = st_theme(key="st_theme_1")
|
56 |
|
57 |
|
58 |
close_group_def = {
|
59 |
'headerName': 'CLOSED DATASETS',
|
|
|
|
|
|
|
|
|
60 |
'children': [
|
61 |
{'headerName': column.replace('_', ''),
|
62 |
'field': column,
|
@@ -70,8 +74,8 @@ def mutil_header_options(column_list: list, avg_column: str, is_section: bool):
|
|
70 |
'headerClass': 'custom-header-style',
|
71 |
'cellClass': 'custom-cell-style',
|
72 |
'sortable': True,
|
73 |
-
'width': 150,
|
74 |
-
|
75 |
|
76 |
} for column in close_group_list
|
77 |
],
|
@@ -79,6 +83,10 @@ def mutil_header_options(column_list: list, avg_column: str, is_section: bool):
|
|
79 |
}
|
80 |
open_group_def = {
|
81 |
'headerName': 'OPEN DATASETS',
|
|
|
|
|
|
|
|
|
82 |
'children': [
|
83 |
{'headerName': column,
|
84 |
'field': column,
|
@@ -90,8 +98,8 @@ def mutil_header_options(column_list: list, avg_column: str, is_section: bool):
|
|
90 |
'headerClass': 'custom-header-style',
|
91 |
'cellClass': 'custom-cell-style',
|
92 |
'sortable': True,
|
93 |
-
'width': 150,
|
94 |
-
|
95 |
|
96 |
} for column in open_group_list
|
97 |
],
|
@@ -100,7 +108,7 @@ def mutil_header_options(column_list: list, avg_column: str, is_section: bool):
|
|
100 |
return [close_group_def, open_group_def]
|
101 |
|
102 |
|
103 |
-
def get_header_options(column_list: list, avg_column: str,
|
104 |
grid_options = {
|
105 |
'columnDefs': [
|
106 |
{
|
@@ -112,7 +120,13 @@ def get_header_options(column_list: list, avg_column: str, is_section: bool):
|
|
112 |
'cellClass': 'custom-cell-style',
|
113 |
'autoHeaderHeight': True,
|
114 |
"tooltipValueGetter": JsCode(
|
115 |
-
"""
|
|
|
|
|
|
|
|
|
|
|
|
|
116 |
),
|
117 |
"width": 250,
|
118 |
'cellRenderer': JsCode("""class CustomHTML {
|
@@ -128,20 +142,24 @@ def get_header_options(column_list: list, avg_column: str, is_section: bool):
|
|
128 |
return this.eGui;
|
129 |
}
|
130 |
}"""),
|
131 |
-
'suppressSizeToFit': True
|
|
|
132 |
|
133 |
},
|
134 |
{'headerName': "Vendor",
|
135 |
'field': 'vendor',
|
136 |
'headerClass': 'custom-header-style',
|
137 |
'cellClass': 'custom-cell-style',
|
138 |
-
# 'suppressSizeToFit': True
|
|
|
139 |
},
|
140 |
{'headerName': "Overall Score",
|
141 |
'field': avg_column,
|
142 |
'headerClass': 'custom-header-style',
|
143 |
'cellClass': 'custom-cell-style',
|
144 |
-
# 'suppressSizeToFit': True
|
|
|
|
|
145 |
},
|
146 |
|
147 |
# Add Open average column definition
|
@@ -149,14 +167,18 @@ def get_header_options(column_list: list, avg_column: str, is_section: bool):
|
|
149 |
'field': 'Open average',
|
150 |
'headerClass': 'custom-header-style',
|
151 |
'cellClass': 'custom-cell-style',
|
152 |
-
# 'suppressSizeToFit': True
|
|
|
|
|
153 |
},
|
154 |
|
155 |
{'headerName': 'Closed Average',
|
156 |
'field': 'Closed average',
|
157 |
'headerClass': 'custom-header-style',
|
158 |
'cellClass': 'custom-cell-style',
|
159 |
-
# 'suppressSizeToFit': True
|
|
|
|
|
160 |
},
|
161 |
|
162 |
{
|
@@ -165,6 +187,8 @@ def get_header_options(column_list: list, avg_column: str, is_section: bool):
|
|
165 |
'headerClass': 'custom-header-style',
|
166 |
'cellClass': 'custom-cell-style',
|
167 |
# 'suppressSizeToFit': True,
|
|
|
|
|
168 |
},
|
169 |
{
|
170 |
'headerName': 'Embd Dim',
|
@@ -172,6 +196,20 @@ def get_header_options(column_list: list, avg_column: str, is_section: bool):
|
|
172 |
'headerClass': 'custom-header-style',
|
173 |
'cellClass': 'custom-cell-style',
|
174 |
# 'suppressSizeToFit': True,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
175 |
},
|
176 |
{
|
177 |
'headerName': 'Number of Parameters',
|
@@ -191,6 +229,8 @@ def get_header_options(column_list: list, avg_column: str, is_section: bool):
|
|
191 |
),
|
192 |
"width": 120,
|
193 |
# 'suppressSizeToFit': True,
|
|
|
|
|
194 |
},
|
195 |
{
|
196 |
'headerName': 'Context Length',
|
@@ -198,6 +238,20 @@ def get_header_options(column_list: list, avg_column: str, is_section: bool):
|
|
198 |
'headerClass': 'custom-header-style',
|
199 |
'cellClass': 'custom-cell-style',
|
200 |
# 'suppressSizeToFit': True,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
201 |
},
|
202 |
|
203 |
*mutil_header_options(column_list, avg_column, is_section)
|
@@ -216,6 +270,7 @@ def get_header_options(column_list: list, avg_column: str, is_section: bool):
|
|
216 |
"colIds": [column for column in column_list if column not in (avg_column, "Closed average", "Open average")]
|
217 |
},
|
218 |
"tooltipShowDelay": 500,
|
|
|
219 |
|
220 |
}
|
221 |
|
|
|
4 |
from st_aggrid import JsCode
|
5 |
from streamlit_theme import st_theme
|
6 |
|
|
|
7 |
HEADER_STYLE = {'fontSize': '18px'}
|
8 |
CELL_STYLE = {'fontSize': '18px'}
|
9 |
LINK = ' https://huggingface.co/datasets/embedding-benchmark/'
|
10 |
|
11 |
+
|
12 |
def get_dataset_url_name(field_name):
|
13 |
"""Convert field name to proper URL format for closed datasets"""
|
14 |
# Handle field names like "ClosedDataset 2 (German Legal Sentences)"
|
|
|
25 |
# Return original field_name for open datasets
|
26 |
return field_name
|
27 |
|
28 |
+
|
29 |
def mutil_header_options(column_list: list, avg_column: str, is_section: bool):
|
30 |
"""
|
31 |
get mutil_header_options - 优化版本,减少组件实例化
|
|
|
51 |
mutil_column_list = [column for column in column_list if
|
52 |
column not in (avg_column, "Closed average", "Open average")]
|
53 |
close_group_list = list(filter(lambda x: x.startswith('_') or x.startswith("ClosedDataset "), mutil_column_list))
|
54 |
+
open_group_list = list(
|
55 |
+
filter(lambda x: not x.startswith('_') and not x.startswith("ClosedDataset "), mutil_column_list))
|
|
|
56 |
|
57 |
|
58 |
close_group_def = {
|
59 |
'headerName': 'CLOSED DATASETS',
|
60 |
+
'width': 'fit-content',
|
61 |
+
'headerClass': 'custom-header-style',
|
62 |
+
'cellClass': 'custom-cell-style',
|
63 |
+
'autoHeaderHeight': True,
|
64 |
'children': [
|
65 |
{'headerName': column.replace('_', ''),
|
66 |
'field': column,
|
|
|
74 |
'headerClass': 'custom-header-style',
|
75 |
'cellClass': 'custom-cell-style',
|
76 |
'sortable': True,
|
77 |
+
# 'width': 150,
|
78 |
+
"suppressColumnVirtualisation": True,
|
79 |
|
80 |
} for column in close_group_list
|
81 |
],
|
|
|
83 |
}
|
84 |
open_group_def = {
|
85 |
'headerName': 'OPEN DATASETS',
|
86 |
+
'width': 'fit-content',
|
87 |
+
'headerClass': 'custom-header-style',
|
88 |
+
'cellClass': 'custom-cell-style',
|
89 |
+
'autoHeaderHeight': True,
|
90 |
'children': [
|
91 |
{'headerName': column,
|
92 |
'field': column,
|
|
|
98 |
'headerClass': 'custom-header-style',
|
99 |
'cellClass': 'custom-cell-style',
|
100 |
'sortable': True,
|
101 |
+
# 'width': 150,
|
102 |
+
"suppressColumnVirtualisation": True,
|
103 |
|
104 |
} for column in open_group_list
|
105 |
],
|
|
|
108 |
return [close_group_def, open_group_def]
|
109 |
|
110 |
|
111 |
+
def get_header_options(column_list: list, avg_column: str, is_section: bool):
|
112 |
grid_options = {
|
113 |
'columnDefs': [
|
114 |
{
|
|
|
120 |
'cellClass': 'custom-cell-style',
|
121 |
'autoHeaderHeight': True,
|
122 |
"tooltipValueGetter": JsCode(
|
123 |
+
"""
|
124 |
+
function(p) {
|
125 |
+
const value = p.value || "";
|
126 |
+
const link = p.data && p.data.reference ? p.data.reference : "";
|
127 |
+
return link ? `${value} (${link})` : value;
|
128 |
+
}
|
129 |
+
"""
|
130 |
),
|
131 |
"width": 250,
|
132 |
'cellRenderer': JsCode("""class CustomHTML {
|
|
|
142 |
return this.eGui;
|
143 |
}
|
144 |
}"""),
|
145 |
+
'suppressSizeToFit': True,
|
146 |
+
'headerTooltip': 'Model Name',
|
147 |
|
148 |
},
|
149 |
{'headerName': "Vendor",
|
150 |
'field': 'vendor',
|
151 |
'headerClass': 'custom-header-style',
|
152 |
'cellClass': 'custom-cell-style',
|
153 |
+
# 'suppressSizeToFit': True,
|
154 |
+
'headerTooltip': 'Vendor',
|
155 |
},
|
156 |
{'headerName': "Overall Score",
|
157 |
'field': avg_column,
|
158 |
'headerClass': 'custom-header-style',
|
159 |
'cellClass': 'custom-cell-style',
|
160 |
+
# 'suppressSizeToFit': True,
|
161 |
+
'headerTooltip': 'Overall Score',
|
162 |
+
|
163 |
},
|
164 |
|
165 |
# Add Open average column definition
|
|
|
167 |
'field': 'Open average',
|
168 |
'headerClass': 'custom-header-style',
|
169 |
'cellClass': 'custom-cell-style',
|
170 |
+
# 'suppressSizeToFit': True,
|
171 |
+
'headerTooltip': 'Open Average',
|
172 |
+
|
173 |
},
|
174 |
|
175 |
{'headerName': 'Closed Average',
|
176 |
'field': 'Closed average',
|
177 |
'headerClass': 'custom-header-style',
|
178 |
'cellClass': 'custom-cell-style',
|
179 |
+
# 'suppressSizeToFit': True,
|
180 |
+
'headerTooltip': 'Closed Average',
|
181 |
+
|
182 |
},
|
183 |
|
184 |
{
|
|
|
187 |
'headerClass': 'custom-header-style',
|
188 |
'cellClass': 'custom-cell-style',
|
189 |
# 'suppressSizeToFit': True,
|
190 |
+
'headerTooltip': 'Embd Dtype',
|
191 |
+
|
192 |
},
|
193 |
{
|
194 |
'headerName': 'Embd Dim',
|
|
|
196 |
'headerClass': 'custom-header-style',
|
197 |
'cellClass': 'custom-cell-style',
|
198 |
# 'suppressSizeToFit': True,
|
199 |
+
'valueFormatter': JsCode(
|
200 |
+
"""
|
201 |
+
function(params) {
|
202 |
+
const num = params.value;
|
203 |
+
if (typeof num !== "number") return num;
|
204 |
+
if (Math.abs(num) >= 10000) {
|
205 |
+
return num.toLocaleString("en-US");
|
206 |
+
}
|
207 |
+
return num;
|
208 |
+
}
|
209 |
+
"""
|
210 |
+
),
|
211 |
+
'headerTooltip': 'Embd Dim',
|
212 |
+
|
213 |
},
|
214 |
{
|
215 |
'headerName': 'Number of Parameters',
|
|
|
229 |
),
|
230 |
"width": 120,
|
231 |
# 'suppressSizeToFit': True,
|
232 |
+
'headerTooltip': 'Number of Parameters',
|
233 |
+
|
234 |
},
|
235 |
{
|
236 |
'headerName': 'Context Length',
|
|
|
238 |
'headerClass': 'custom-header-style',
|
239 |
'cellClass': 'custom-cell-style',
|
240 |
# 'suppressSizeToFit': True,
|
241 |
+
'valueFormatter': JsCode(
|
242 |
+
"""
|
243 |
+
function(params) {
|
244 |
+
const num = params.value;
|
245 |
+
if (typeof num !== "number") return num;
|
246 |
+
if (Math.abs(num) >= 10000) {
|
247 |
+
return num.toLocaleString("en-US");
|
248 |
+
}
|
249 |
+
return num;
|
250 |
+
}
|
251 |
+
"""
|
252 |
+
),
|
253 |
+
'headerTooltip': 'Context Length',
|
254 |
+
|
255 |
},
|
256 |
|
257 |
*mutil_header_options(column_list, avg_column, is_section)
|
|
|
270 |
"colIds": [column for column in column_list if column not in (avg_column, "Closed average", "Open average")]
|
271 |
},
|
272 |
"tooltipShowDelay": 500,
|
273 |
+
"suppressColumnVirtualisation": True
|
274 |
|
275 |
}
|
276 |
|
requirements.txt
CHANGED
@@ -3,4 +3,4 @@ st-pages==1.0.1
|
|
3 |
msgpack==1.1.0
|
4 |
zstandard==0.23.0
|
5 |
st-theme==1.2.3
|
6 |
-
https://github.com/
|
|
|
3 |
msgpack==1.1.0
|
4 |
zstandard==0.23.0
|
5 |
st-theme==1.2.3
|
6 |
+
https://github.com/embedding-benchmark/streamlit-aggrid/releases/download/v0.01/streamlit_aggrid-1.1.7-py3-none-any.whl
|