Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -2,6 +2,13 @@ from utils import *
|
|
| 2 |
|
| 3 |
global data_component
|
| 4 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
with gr.Blocks() as block:
|
| 6 |
gr.Markdown(
|
| 7 |
LEADERBOARD_INTRODUCTION
|
|
@@ -21,6 +28,12 @@ with gr.Blocks() as block:
|
|
| 21 |
TABLE_INTRODUCTION
|
| 22 |
)
|
| 23 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
data_component = gr.components.Dataframe(
|
| 25 |
value=get_df(),
|
| 26 |
headers=COLUMN_NAMES,
|
|
@@ -31,6 +44,7 @@ with gr.Blocks() as block:
|
|
| 31 |
height=1000
|
| 32 |
)
|
| 33 |
refresh_button = gr.Button("Refresh")
|
|
|
|
| 34 |
refresh_button.click(fn=refresh_data, outputs=data_component)
|
| 35 |
|
| 36 |
# table 2
|
|
|
|
| 2 |
|
| 3 |
global data_component
|
| 4 |
|
| 5 |
+
|
| 6 |
+
def update_table(query):
|
| 7 |
+
df = get_df()
|
| 8 |
+
filtered_df = search_models(df, query)
|
| 9 |
+
return filtered_df
|
| 10 |
+
|
| 11 |
+
|
| 12 |
with gr.Blocks() as block:
|
| 13 |
gr.Markdown(
|
| 14 |
LEADERBOARD_INTRODUCTION
|
|
|
|
| 28 |
TABLE_INTRODUCTION
|
| 29 |
)
|
| 30 |
|
| 31 |
+
search_bar = gr.Textbox(
|
| 32 |
+
placeholder="Search models...",
|
| 33 |
+
show_label=False,
|
| 34 |
+
elem_id="search-bar"
|
| 35 |
+
)
|
| 36 |
+
|
| 37 |
data_component = gr.components.Dataframe(
|
| 38 |
value=get_df(),
|
| 39 |
headers=COLUMN_NAMES,
|
|
|
|
| 44 |
height=1000
|
| 45 |
)
|
| 46 |
refresh_button = gr.Button("Refresh")
|
| 47 |
+
search_bar.change(fn=update_table, inputs=[search_bar], outputs=data_component)
|
| 48 |
refresh_button.click(fn=refresh_data, outputs=data_component)
|
| 49 |
|
| 50 |
# table 2
|