test, hope it works please
Browse files
app.py
CHANGED
|
@@ -503,14 +503,30 @@ def search_df(author):
|
|
| 503 |
return markdown_text
|
| 504 |
|
| 505 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 506 |
with gr.Blocks() as demo:
|
| 507 |
gr.Markdown("""<h1 align="center" id="space-title">🤗 Huggingface Leaderboard</h1>""")
|
| 508 |
gr.Markdown(INTRODUCTION_TEXT, elem_classes="markdown-text")
|
| 509 |
|
|
|
|
|
|
|
|
|
|
| 510 |
all_models = get_models("models")
|
| 511 |
all_datasets = get_models("datasets")
|
| 512 |
all_spaces = get_models("spaces")
|
| 513 |
-
|
| 514 |
with gr.Column(min_width=320):
|
| 515 |
with gr.Box():
|
| 516 |
orgs = gr.Checkbox(value=True, label="Show Organizations", interactive=True)
|
|
@@ -560,6 +576,8 @@ with gr.Blocks() as demo:
|
|
| 560 |
commit = upload_datasets([models_df, dataset_df, spaces_df])
|
| 561 |
print(commit)
|
| 562 |
|
|
|
|
|
|
|
| 563 |
orgs.change(fn=update_table, inputs=[orgs, users], outputs=gr_models)
|
| 564 |
|
| 565 |
orgs.change(fn=update_table_datasets, inputs=[orgs, users], outputs=gr_datasets)
|
|
|
|
| 503 |
return markdown_text
|
| 504 |
|
| 505 |
|
| 506 |
+
def search_bar_in_df_fn(search_text):
|
| 507 |
+
dfs = [models_df, dataset_df, spaces_df]
|
| 508 |
+
|
| 509 |
+
if not search_text:
|
| 510 |
+
return dfs
|
| 511 |
+
|
| 512 |
+
lists_to_return = []
|
| 513 |
+
|
| 514 |
+
for df in dfs:
|
| 515 |
+
lists_to_return.append(df[df['👤 Author'].str.contains(f'"https://huggingface.co/{search_text}"', case=False, na=False)])
|
| 516 |
+
return lists_to_return
|
| 517 |
+
|
| 518 |
+
|
| 519 |
with gr.Blocks() as demo:
|
| 520 |
gr.Markdown("""<h1 align="center" id="space-title">🤗 Huggingface Leaderboard</h1>""")
|
| 521 |
gr.Markdown(INTRODUCTION_TEXT, elem_classes="markdown-text")
|
| 522 |
|
| 523 |
+
with gr.Column(min_width=320):
|
| 524 |
+
search_bar_in_df = gr.Textbox(placeholder="🔍 Search for a author", show_label=False)
|
| 525 |
+
|
| 526 |
all_models = get_models("models")
|
| 527 |
all_datasets = get_models("datasets")
|
| 528 |
all_spaces = get_models("spaces")
|
| 529 |
+
|
| 530 |
with gr.Column(min_width=320):
|
| 531 |
with gr.Box():
|
| 532 |
orgs = gr.Checkbox(value=True, label="Show Organizations", interactive=True)
|
|
|
|
| 576 |
commit = upload_datasets([models_df, dataset_df, spaces_df])
|
| 577 |
print(commit)
|
| 578 |
|
| 579 |
+
search_bar_in_df.submit(fn=search_bar_in_df_fn, inputs=search_bar_in_df, outputs=[gr_models, gr_datasets, gr_spaces])
|
| 580 |
+
|
| 581 |
orgs.change(fn=update_table, inputs=[orgs, users], outputs=gr_models)
|
| 582 |
|
| 583 |
orgs.change(fn=update_table_datasets, inputs=[orgs, users], outputs=gr_datasets)
|