devingulliver commited on
Commit
38210ee
β€’
1 Parent(s): 16b50a3

First pass at table filtering

Browse files
Files changed (1) hide show
  1. app.py +21 -2
app.py CHANGED
@@ -1,10 +1,20 @@
1
  import os
 
2
  import requests
3
  import huggingface_hub
4
  import gradio as gr
5
 
 
6
  webhook_url = os.environ.get("WEBHOOK_URL")
7
 
 
 
 
 
 
 
 
 
8
  def submit_model(name):
9
  try:
10
  huggingface_hub.hf_hub_download(repo_id=name, filename="config.json") # sanity check input
@@ -33,8 +43,16 @@ with gr.Blocks() as demo:
33
 
34
  with gr.Tabs(elem_classes="tab-buttons") as tabs:
35
  with gr.Tab("πŸ… LLM Benchmark"):
36
- gr.Markdown("Table filters under construction")
37
- gr.Dataframe("data.csv")
 
 
 
 
 
 
 
 
38
 
39
  with gr.Tab("πŸ“ About"):
40
  gr.Markdown("""
@@ -50,6 +68,7 @@ with gr.Blocks() as demo:
50
  submit = gr.Button("Submit", variant="primary", scale=0)
51
 
52
  output = gr.Markdown("Enter a public HF repo id, then hit Submit to add it to the evaluation queue.")
 
53
  submit.click(fn=submit_model, inputs=model_name, outputs=output)
54
 
55
 
 
1
  import os
2
+ import pandas as pd
3
  import requests
4
  import huggingface_hub
5
  import gradio as gr
6
 
7
+ data = pd.read_csv("data.csv")
8
  webhook_url = os.environ.get("WEBHOOK_URL")
9
 
10
+ def filter_table(name, type, arch, lcns):
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(lcns)]
16
+ return tmp
17
+
18
  def submit_model(name):
19
  try:
20
  huggingface_hub.hf_hub_download(repo_id=name, filename="config.json") # sanity check input
 
43
 
44
  with gr.Tabs(elem_classes="tab-buttons") as tabs:
45
  with gr.Tab("πŸ… LLM Benchmark"):
46
+ with gr.Row():
47
+ namefilter = model_name = gr.Textbox(max_lines=1, placeholder="Search by model name...", show_label=False)
48
+ typefilter = gr.Dropdown(label="Filter by model type", multiselect=True, choices=list(set(data["Type"])), value=list(set(data["Type"])))
49
+ archfilter = gr.Dropdown(label="Filter by model architecture", multiselect=True, choices=list(set(data["Architecture"])), value=list(set(data["Architecture"])))
50
+ lcnsfilter = gr.Dropdown(label="Filter by model license", multiselect=True, choices=list(set(data["License"])), value=list(set(data["License"])))
51
+ filter = gr.Button("Filter")
52
+
53
+ table = gr.Dataframe(data)
54
+
55
+ filter.click(fn=filter_table, inputs=[namefilter,typefilter,archfilter,lcnsfilter], outputs=table)
56
 
57
  with gr.Tab("πŸ“ About"):
58
  gr.Markdown("""
 
68
  submit = gr.Button("Submit", variant="primary", scale=0)
69
 
70
  output = gr.Markdown("Enter a public HF repo id, then hit Submit to add it to the evaluation queue.")
71
+
72
  submit.click(fn=submit_model, inputs=model_name, outputs=output)
73
 
74