Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
style clean up
Browse files
app.py
CHANGED
@@ -309,6 +309,11 @@ def refresh():
|
|
309 |
)
|
310 |
|
311 |
|
|
|
|
|
|
|
|
|
|
|
312 |
custom_css = """
|
313 |
#changelog-text {
|
314 |
font-size: 16px !important;
|
@@ -335,17 +340,28 @@ custom_css = """
|
|
335 |
transform: scale(1.3);
|
336 |
}
|
337 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
338 |
/* Hides the final column */
|
339 |
table td:last-child,
|
340 |
table th:last-child {
|
341 |
display: none;
|
342 |
}
|
343 |
-
"""
|
344 |
|
|
|
|
|
|
|
|
|
|
|
|
|
345 |
|
346 |
-
|
347 |
-
filtered_df = df[df["model_name_for_query"].str.contains(query, case=False)]
|
348 |
-
return filtered_df
|
349 |
|
350 |
|
351 |
demo = gr.Blocks(css=custom_css)
|
@@ -365,22 +381,29 @@ with demo:
|
|
365 |
with gr.Accordion("✨ CHANGELOG", open=False):
|
366 |
changelog = gr.Markdown(CHANGELOG_TEXT, elem_id="changelog-text")
|
367 |
|
368 |
-
|
|
|
|
|
|
|
369 |
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
)
|
378 |
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
|
|
|
|
|
|
|
|
|
|
384 |
|
385 |
gr.Markdown(EVALUATION_QUEUE_TEXT, elem_classes="markdown-text")
|
386 |
|
|
|
309 |
)
|
310 |
|
311 |
|
312 |
+
def search_table(df, query):
|
313 |
+
filtered_df = df[df["model_name_for_query"].str.contains(query, case=False)]
|
314 |
+
return filtered_df
|
315 |
+
|
316 |
+
|
317 |
custom_css = """
|
318 |
#changelog-text {
|
319 |
font-size: 16px !important;
|
|
|
340 |
transform: scale(1.3);
|
341 |
}
|
342 |
|
343 |
+
#leaderboard-table {
|
344 |
+
margin-top: 15px
|
345 |
+
}
|
346 |
+
|
347 |
+
#search-bar {
|
348 |
+
padding: 0px;
|
349 |
+
}
|
350 |
+
|
351 |
/* Hides the final column */
|
352 |
table td:last-child,
|
353 |
table th:last-child {
|
354 |
display: none;
|
355 |
}
|
|
|
356 |
|
357 |
+
table td:first-child,
|
358 |
+
table th:first-child {
|
359 |
+
max-width: 400px;
|
360 |
+
overflow: auto;
|
361 |
+
white-space: nowrap;
|
362 |
+
}
|
363 |
|
364 |
+
"""
|
|
|
|
|
365 |
|
366 |
|
367 |
demo = gr.Blocks(css=custom_css)
|
|
|
381 |
with gr.Accordion("✨ CHANGELOG", open=False):
|
382 |
changelog = gr.Markdown(CHANGELOG_TEXT, elem_id="changelog-text")
|
383 |
|
384 |
+
with gr.Box():
|
385 |
+
search_bar = gr.Textbox(
|
386 |
+
placeholder="Search models...", show_label=False, elem_id="search-bar"
|
387 |
+
)
|
388 |
|
389 |
+
leaderboard_table = gr.components.Dataframe(
|
390 |
+
value=leaderboard_df,
|
391 |
+
headers=COLS,
|
392 |
+
datatype=TYPES,
|
393 |
+
max_rows=5,
|
394 |
+
elem_id="leaderboard-table",
|
395 |
+
)
|
|
|
396 |
|
397 |
+
# Dummy leaderboard for handling the case when the user uses backspace key
|
398 |
+
hidden_leaderboard_table_for_search = gr.components.Dataframe(
|
399 |
+
value=original_df, headers=COLS, datatype=TYPES, max_rows=5, visible=False
|
400 |
+
)
|
401 |
+
|
402 |
+
search_bar.change(
|
403 |
+
search_table,
|
404 |
+
[hidden_leaderboard_table_for_search, search_bar],
|
405 |
+
leaderboard_table,
|
406 |
+
)
|
407 |
|
408 |
gr.Markdown(EVALUATION_QUEUE_TEXT, elem_classes="markdown-text")
|
409 |
|