Spaces:
Runtime error
Runtime error
Revert UI changes
Browse files
app.py
CHANGED
|
@@ -7,15 +7,23 @@ import gradio as gr
|
|
| 7 |
data = pd.read_csv("data.csv")
|
| 8 |
webhook_url = os.environ.get("WEBHOOK_URL")
|
| 9 |
|
| 10 |
-
def filter_table(name, type, arch, license):
|
| 11 |
tmp = data
|
|
|
|
| 12 |
tmp = tmp[tmp["Name"].str.contains(name)]
|
| 13 |
tmp = tmp[tmp["Type"].isin(type)]
|
| 14 |
tmp = tmp[tmp["Architecture"].isin(arch)]
|
| 15 |
tmp = tmp[tmp["License"].isin(license)]
|
| 16 |
-
|
| 17 |
-
tmp
|
| 18 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
return tmp
|
| 20 |
|
| 21 |
def submit_model(name):
|
|
@@ -47,25 +55,25 @@ with gr.Blocks() as demo:
|
|
| 47 |
with gr.Tabs(elem_classes="tab-buttons") as tabs:
|
| 48 |
with gr.Tab("π
LLM Benchmark"):
|
| 49 |
with gr.Row():
|
| 50 |
-
with gr.Column(
|
| 51 |
namefilter = gr.Textbox(max_lines=1, label="Search by model name and hit Enter")
|
| 52 |
-
gr.
|
| 53 |
|
| 54 |
-
with gr.Column(
|
| 55 |
typefilter = gr.CheckboxGroup(label="Filter by model type", choices=list(data["Type"].unique()), value=[n for n in data["Type"].unique() if n not in ["Pending"]])
|
| 56 |
|
| 57 |
-
with gr.Column(
|
| 58 |
archfilter = gr.CheckboxGroup(label="Filter by model architecture", choices=list(data["Architecture"].unique()), value=list(data["Architecture"].unique()))
|
| 59 |
lcnsfilter = gr.CheckboxGroup(label="Filter by model license", choices=list(data["License"].unique()), value=list(data["License"].unique()))
|
| 60 |
|
| 61 |
table = gr.Dataframe(datatype="markdown")
|
| 62 |
|
| 63 |
-
namefilter.submit(filter_table, [namefilter,typefilter,archfilter,lcnsfilter], table)
|
| 64 |
|
| 65 |
-
for filter in [typefilter,
|
| 66 |
-
filter.input(filter_table, [namefilter,typefilter,archfilter,lcnsfilter], table)
|
| 67 |
|
| 68 |
-
demo.load(fn=filter_table, inputs=[namefilter,typefilter,archfilter,lcnsfilter], outputs=table)
|
| 69 |
|
| 70 |
with gr.Tab("π About"):
|
| 71 |
gr.Markdown("""
|
|
|
|
| 7 |
data = pd.read_csv("data.csv")
|
| 8 |
webhook_url = os.environ.get("WEBHOOK_URL")
|
| 9 |
|
| 10 |
+
def filter_table(cols, name, type, arch, license):
|
| 11 |
tmp = data
|
| 12 |
+
# filter
|
| 13 |
tmp = tmp[tmp["Name"].str.contains(name)]
|
| 14 |
tmp = tmp[tmp["Type"].isin(type)]
|
| 15 |
tmp = tmp[tmp["Architecture"].isin(arch)]
|
| 16 |
tmp = tmp[tmp["License"].isin(license)]
|
| 17 |
+
# show/hide
|
| 18 |
+
tmp = tmp.drop(cols, axis=1)
|
| 19 |
+
# prettify
|
| 20 |
+
if "Type" in tmp:
|
| 21 |
+
tmp["Type"] = tmp["Type"].apply(lambda x: x[0])
|
| 22 |
+
tmp = tmp.rename({"Type": "T"}, axis=1)
|
| 23 |
+
|
| 24 |
+
if "Name" in tmp:
|
| 25 |
+
tmp["Name"] = tmp["Name"].apply(lambda x: f'<a target="_blank" href="https://huggingface.co/{x}" style="color: var(--link-text-color); text-decoration: underline;text-decoration-style: dotted;">{x}</a>')
|
| 26 |
+
|
| 27 |
return tmp
|
| 28 |
|
| 29 |
def submit_model(name):
|
|
|
|
| 55 |
with gr.Tabs(elem_classes="tab-buttons") as tabs:
|
| 56 |
with gr.Tab("π
LLM Benchmark"):
|
| 57 |
with gr.Row():
|
| 58 |
+
with gr.Column():
|
| 59 |
namefilter = gr.Textbox(max_lines=1, label="Search by model name and hit Enter")
|
| 60 |
+
colfilter = gr.CheckboxGroup(label="Hide columns", choices=list(data.columns))
|
| 61 |
|
| 62 |
+
with gr.Column():
|
| 63 |
typefilter = gr.CheckboxGroup(label="Filter by model type", choices=list(data["Type"].unique()), value=[n for n in data["Type"].unique() if n not in ["Pending"]])
|
| 64 |
|
| 65 |
+
with gr.Column():
|
| 66 |
archfilter = gr.CheckboxGroup(label="Filter by model architecture", choices=list(data["Architecture"].unique()), value=list(data["Architecture"].unique()))
|
| 67 |
lcnsfilter = gr.CheckboxGroup(label="Filter by model license", choices=list(data["License"].unique()), value=list(data["License"].unique()))
|
| 68 |
|
| 69 |
table = gr.Dataframe(datatype="markdown")
|
| 70 |
|
| 71 |
+
namefilter.submit(filter_table, [colfilter,namefilter,typefilter,archfilter,lcnsfilter], table)
|
| 72 |
|
| 73 |
+
for filter in [colfilter,typefilter,archfilter,lcnsfilter]:
|
| 74 |
+
filter.input(filter_table, [colfilter,namefilter,typefilter,archfilter,lcnsfilter], table)
|
| 75 |
|
| 76 |
+
demo.load(fn=filter_table, inputs=[colfilter,namefilter,typefilter,archfilter,lcnsfilter], outputs=table)
|
| 77 |
|
| 78 |
with gr.Tab("π About"):
|
| 79 |
gr.Markdown("""
|