Spaces:
Running
Running
BenchmarkBot
commited on
Commit
β’
8e785e9
1
Parent(s):
708b21b
added search bar
Browse files
app.py
CHANGED
@@ -4,7 +4,7 @@ import pandas as pd
|
|
4 |
from apscheduler.schedulers.background import BackgroundScheduler
|
5 |
|
6 |
from src.assets.text_content import TITLE, INTRODUCTION_TEXT, CITATION_BUTTON_LABEL, CITATION_BUTTON_TEXT
|
7 |
-
from src.assets.css_html_js import custom_css
|
8 |
from src.utils import restart_space, load_dataset_repo, make_clickable_model
|
9 |
|
10 |
|
@@ -45,12 +45,25 @@ def get_benchmark_df(benchmark):
|
|
45 |
return df
|
46 |
|
47 |
|
|
|
|
|
|
|
|
|
|
|
48 |
# Define demo interface
|
49 |
demo = gr.Blocks(css=custom_css)
|
50 |
with demo:
|
51 |
gr.HTML(TITLE)
|
52 |
gr.Markdown(INTRODUCTION_TEXT, elem_classes="markdown-text")
|
53 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
54 |
with gr.Tabs(elem_classes="tab-buttons") as tabs:
|
55 |
with gr.TabItem("π₯οΈ A100-80GB Benchmark ποΈ", elem_id="A100-benchmark", id=0):
|
56 |
|
@@ -63,27 +76,53 @@ with demo:
|
|
63 |
gr.HTML(SINGLE_A100_TEXT)
|
64 |
|
65 |
single_A100_df = get_benchmark_df(benchmark="1xA100-80GB")
|
66 |
-
|
|
|
67 |
value=single_A100_df,
|
68 |
datatype=COLUMNS_DATATYPES,
|
69 |
headers=list(COLUMNS_MAPPING.values()),
|
70 |
elem_id="1xA100-table",
|
71 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
72 |
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
87 |
|
88 |
with gr.Row():
|
89 |
with gr.Accordion("π Citation", open=False):
|
|
|
4 |
from apscheduler.schedulers.background import BackgroundScheduler
|
5 |
|
6 |
from src.assets.text_content import TITLE, INTRODUCTION_TEXT, CITATION_BUTTON_LABEL, CITATION_BUTTON_TEXT
|
7 |
+
from src.assets.css_html_js import custom_css
|
8 |
from src.utils import restart_space, load_dataset_repo, make_clickable_model
|
9 |
|
10 |
|
|
|
45 |
return df
|
46 |
|
47 |
|
48 |
+
def search_table(df, query):
|
49 |
+
filtered_df = df[df["model"].str.contains(query, case=False)]
|
50 |
+
return filtered_df
|
51 |
+
|
52 |
+
|
53 |
# Define demo interface
|
54 |
demo = gr.Blocks(css=custom_css)
|
55 |
with demo:
|
56 |
gr.HTML(TITLE)
|
57 |
gr.Markdown(INTRODUCTION_TEXT, elem_classes="markdown-text")
|
58 |
|
59 |
+
with gr.Row():
|
60 |
+
with gr.Box(elem_id="search-bar-table-box"):
|
61 |
+
search_bar = gr.Textbox(
|
62 |
+
placeholder="π Search your model and press ENTER...",
|
63 |
+
show_label=False,
|
64 |
+
elem_id="search-bar",
|
65 |
+
)
|
66 |
+
|
67 |
with gr.Tabs(elem_classes="tab-buttons") as tabs:
|
68 |
with gr.TabItem("π₯οΈ A100-80GB Benchmark ποΈ", elem_id="A100-benchmark", id=0):
|
69 |
|
|
|
76 |
gr.HTML(SINGLE_A100_TEXT)
|
77 |
|
78 |
single_A100_df = get_benchmark_df(benchmark="1xA100-80GB")
|
79 |
+
# Original leaderboard table
|
80 |
+
single_A100_leaderboard = gr.components.Dataframe(
|
81 |
value=single_A100_df,
|
82 |
datatype=COLUMNS_DATATYPES,
|
83 |
headers=list(COLUMNS_MAPPING.values()),
|
84 |
elem_id="1xA100-table",
|
85 |
)
|
86 |
+
# Dummy Leaderboard table for handling the case when the user uses backspace key
|
87 |
+
single_A100_for_search = gr.components.Dataframe(
|
88 |
+
value=single_A100_df,
|
89 |
+
datatype=COLUMNS_DATATYPES,
|
90 |
+
headers=list(COLUMNS_MAPPING.values()),
|
91 |
+
max_rows=None,
|
92 |
+
visible=False,
|
93 |
+
)
|
94 |
+
search_bar.submit(
|
95 |
+
search_table,
|
96 |
+
[single_A100_for_search, search_bar],
|
97 |
+
single_A100_leaderboard,
|
98 |
+
)
|
99 |
|
100 |
+
MULTI_A100_TEXT = """<h3>Multi-GPU (4xA100):</h3>
|
101 |
+
<ul>
|
102 |
+
<li>Singleton Batch (1)</li>
|
103 |
+
<li>Thousand Tokens (1000)</li>
|
104 |
+
</ul>"""
|
105 |
+
gr.HTML(MULTI_A100_TEXT)
|
106 |
+
multi_A100_df = get_benchmark_df(benchmark="4xA100-80GB")
|
107 |
+
multi_A100_leaderboard = gr.components.Dataframe(
|
108 |
+
value=multi_A100_df,
|
109 |
+
datatype=COLUMNS_DATATYPES,
|
110 |
+
headers=list(COLUMNS_MAPPING.values()),
|
111 |
+
elem_id="4xA100-table",
|
112 |
+
)
|
113 |
+
# Dummy Leaderboard table for handling the case when the user uses backspace key
|
114 |
+
multi_A100_for_search = gr.components.Dataframe(
|
115 |
+
value=single_A100_df,
|
116 |
+
datatype=COLUMNS_DATATYPES,
|
117 |
+
headers=list(COLUMNS_MAPPING.values()),
|
118 |
+
max_rows=None,
|
119 |
+
visible=False,
|
120 |
+
)
|
121 |
+
search_bar.submit(
|
122 |
+
search_table,
|
123 |
+
[multi_A100_for_search, search_bar],
|
124 |
+
multi_A100_leaderboard,
|
125 |
+
)
|
126 |
|
127 |
with gr.Row():
|
128 |
with gr.Accordion("π Citation", open=False):
|