devingulliver commited on
Commit
b414398
β€’
1 Parent(s): e8dad09

First pass at model submission feature

Browse files
Files changed (1) hide show
  1. app.py +43 -13
app.py CHANGED
@@ -1,18 +1,48 @@
 
 
 
1
  import gradio as gr
2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  with gr.Blocks() as demo:
4
- gr.HTML('<h1 style="text-align:center">Subquadratic LLM Leaderboard</h1>')
5
-
6
- with gr.Tab("πŸ… LLM Benchmark"):
7
- gr.Markdown("Table filters coming soon")
8
- gr.Dataframe("data.csv")
9
-
10
- with gr.Tab("πŸ“ About"):
11
- gr.Markdown("""The **Subquadratic LLM Leaderboard** evaluates LLMs with subquadratic architectures (ie RWKV & Mamba) on the same benchmarks as the Open LLM Leaderboard, with the goal of providing open evaluation results while the architectures themselves are pending inclusion in πŸ€— Transformers.
12
- This leaderboard is under construction, check back regularly for further improvements!""")
13
-
14
- with gr.Tab("πŸš€ Submit here!"):
15
- gr.Markdown("Coming soon")
16
-
 
 
 
 
 
 
 
 
 
17
 
18
  demo.launch()
 
1
+ import os
2
+ import requests
3
+ from huggingface_hub import hf_hub_download
4
  import gradio as gr
5
 
6
+ webhook_url = os.environ.get("WEBHOOK_URL")
7
+
8
+ def submit_model(name):
9
+ try:
10
+ hf_hub_download(repo_id=name, filename="config.json") # sanity check input
11
+ result = requests.post(webhook_url, json={"content":name})
12
+ result.raise_for_status()
13
+ except requests.exceptions.HTTPError:
14
+ return "# ERROR: Could not contact queue. Please try again in a few minutes."
15
+ except EntryNotFoundError:
16
+ return "# ERROR: Model does not have a config.json file!"
17
+ except RepositoryNotFoundError:
18
+ return "# ERROR: Model could not be found on the Hugging Face Hub!"
19
+ except:
20
+ return "# ERROR: Unexpected error. Please try again later."
21
+
22
+ return "# SUCCESS: Please wait up to 24 hours for your model to be added to the queue."
23
+
24
  with gr.Blocks() as demo:
25
+ gr.HTML('<style>.tab-buttons button{font-size:1.3em}</style><h1 style="text-align:center">Subquadratic LLM Leaderboard</h1>')
26
+
27
+ with gr.Tabs(elem_classes="tab-buttons") as tabs:
28
+ with gr.Tab("πŸ… LLM Benchmark"):
29
+ gr.Markdown("Table filters under construction")
30
+ gr.Dataframe("data.csv")
31
+
32
+ with gr.Tab("πŸ“ About"):
33
+ gr.Markdown("""
34
+ The **Subquadratic LLM Leaderboard** evaluates LLMs with subquadratic architectures (ie RWKV & Mamba) on the same benchmarks as the Open LLM Leaderboard, with the goal of providing open evaluation results while the architectures themselves are pending inclusion in πŸ€— Transformers.
35
+ This leaderboard is maintained by Devin Gulliver and is still under construction, check back regularly for further improvements!
36
+ """)
37
+
38
+ with gr.Tab("πŸš€ Submit here!"):
39
+ with gr.Group():
40
+ with gr.Row():
41
+ model_name = gr.Textbox(max_lines=1, label="Model Name", scale=4)
42
+ submit = gr.Button("Submit", variant="primary", scale=0)
43
+
44
+ output = gr.Markdown("Enter a public HF repo id, then hit Submit to add it to the evaluation queue.")
45
+ submit.click(fn=submit_model, inputs=model_name, outputs=output)
46
+
47
 
48
  demo.launch()