apply headers when searching as well - search tab item rename to "search report"
Browse files
app.py
CHANGED
@@ -505,6 +505,10 @@ def search_df(author):
|
|
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
|
@@ -512,7 +516,8 @@ def search_bar_in_df_fn(search_text):
|
|
512 |
lists_to_return = []
|
513 |
|
514 |
for df in dfs:
|
515 |
-
lists_to_return.append(df[df['Author Name'].str.contains(f'
|
|
|
516 |
return lists_to_return
|
517 |
|
518 |
|
@@ -562,7 +567,7 @@ with gr.Blocks() as demo:
|
|
562 |
"str"])
|
563 |
|
564 |
|
565 |
-
with gr.TabItem("🔍 Search", id=4):
|
566 |
with gr.Column(min_width=320):
|
567 |
search_bar = gr.Textbox(
|
568 |
placeholder=" 🔍 Search for your author and press ENTER",
|
|
|
505 |
|
506 |
def search_bar_in_df_fn(search_text):
|
507 |
dfs = [models_df, dataset_df, spaces_df]
|
508 |
+
headers = [headers_models, headers_datasets, headers_spaces]
|
509 |
+
|
510 |
+
for index in range(len(dfs)):
|
511 |
+
dfs[index] = apply_headers(dfs[index], headers[index])
|
512 |
|
513 |
if not search_text:
|
514 |
return dfs
|
|
|
516 |
lists_to_return = []
|
517 |
|
518 |
for df in dfs:
|
519 |
+
lists_to_return.append(df[df['👤 Author Name'].str.contains(f'https://huggingface.co/{search_text}', case=False, na=False)])
|
520 |
+
|
521 |
return lists_to_return
|
522 |
|
523 |
|
|
|
567 |
"str"])
|
568 |
|
569 |
|
570 |
+
with gr.TabItem("🔍 Search report", id=4):
|
571 |
with gr.Column(min_width=320):
|
572 |
search_bar = gr.Textbox(
|
573 |
placeholder=" 🔍 Search for your author and press ENTER",
|