Search on ENTER
Browse files
app.py
CHANGED
|
@@ -348,8 +348,14 @@ custom_css = """
|
|
| 348 |
margin-top: 15px
|
| 349 |
}
|
| 350 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 351 |
#search-bar {
|
| 352 |
padding: 0px;
|
|
|
|
| 353 |
}
|
| 354 |
|
| 355 |
/* Hides the final column */
|
|
@@ -358,6 +364,8 @@ table th:last-child {
|
|
| 358 |
display: none;
|
| 359 |
}
|
| 360 |
|
|
|
|
|
|
|
| 361 |
table td:first-child,
|
| 362 |
table th:first-child {
|
| 363 |
max-width: 400px;
|
|
@@ -385,9 +393,11 @@ with demo:
|
|
| 385 |
with gr.Accordion("✨ CHANGELOG", open=False):
|
| 386 |
changelog = gr.Markdown(CHANGELOG_TEXT, elem_id="changelog-text")
|
| 387 |
|
| 388 |
-
with gr.Box():
|
| 389 |
search_bar = gr.Textbox(
|
| 390 |
-
placeholder="Search
|
|
|
|
|
|
|
| 391 |
)
|
| 392 |
|
| 393 |
leaderboard_table = gr.components.Dataframe(
|
|
@@ -403,7 +413,7 @@ with demo:
|
|
| 403 |
value=original_df, headers=COLS, datatype=TYPES, max_rows=5, visible=False
|
| 404 |
)
|
| 405 |
|
| 406 |
-
search_bar.
|
| 407 |
search_table,
|
| 408 |
[hidden_leaderboard_table_for_search, search_bar],
|
| 409 |
leaderboard_table,
|
|
@@ -479,4 +489,3 @@ scheduler = BackgroundScheduler()
|
|
| 479 |
scheduler.add_job(restart_space, "interval", seconds=3600)
|
| 480 |
scheduler.start()
|
| 481 |
demo.queue(concurrency_count=40).launch()
|
| 482 |
-
|
|
|
|
| 348 |
margin-top: 15px
|
| 349 |
}
|
| 350 |
|
| 351 |
+
#search-bar-table-box > div:first-child {
|
| 352 |
+
background: none;
|
| 353 |
+
border: none;
|
| 354 |
+
}
|
| 355 |
+
|
| 356 |
#search-bar {
|
| 357 |
padding: 0px;
|
| 358 |
+
width: 30%;
|
| 359 |
}
|
| 360 |
|
| 361 |
/* Hides the final column */
|
|
|
|
| 364 |
display: none;
|
| 365 |
}
|
| 366 |
|
| 367 |
+
|
| 368 |
+
/* Limit the width of the first column so that names don't expand too much */
|
| 369 |
table td:first-child,
|
| 370 |
table th:first-child {
|
| 371 |
max-width: 400px;
|
|
|
|
| 393 |
with gr.Accordion("✨ CHANGELOG", open=False):
|
| 394 |
changelog = gr.Markdown(CHANGELOG_TEXT, elem_id="changelog-text")
|
| 395 |
|
| 396 |
+
with gr.Box(elem_id="search-bar-table-box"):
|
| 397 |
search_bar = gr.Textbox(
|
| 398 |
+
placeholder="Search your model and press ENTER...",
|
| 399 |
+
show_label=False,
|
| 400 |
+
elem_id="search-bar",
|
| 401 |
)
|
| 402 |
|
| 403 |
leaderboard_table = gr.components.Dataframe(
|
|
|
|
| 413 |
value=original_df, headers=COLS, datatype=TYPES, max_rows=5, visible=False
|
| 414 |
)
|
| 415 |
|
| 416 |
+
search_bar.submit(
|
| 417 |
search_table,
|
| 418 |
[hidden_leaderboard_table_for_search, search_bar],
|
| 419 |
leaderboard_table,
|
|
|
|
| 489 |
scheduler.add_job(restart_space, "interval", seconds=3600)
|
| 490 |
scheduler.start()
|
| 491 |
demo.queue(concurrency_count=40).launch()
|
|
|