devingulliver's picture
Update app.py
387cdcd verified
raw
history blame
2.39 kB
import os
import requests
from huggingface_hub import hf_hub_download
import gradio as gr
webhook_url = os.environ.get("WEBHOOK_URL")
print(webhook_url) # troubleshoot env var setup
def submit_model(name):
try:
hf_hub_download(repo_id=name, filename="config.json") # sanity check input
except EntryNotFoundError:
return "# ERROR: Model does not have a config.json file!"
except RepositoryNotFoundError:
return "# ERROR: Model could not be found on the Hugging Face Hub!"
except:
return "# ERROR: Unexpected error. Please try again later."
try:
result = requests.post(webhook_url, json={"content":name})
result.raise_for_status()
except requests.exceptions.HTTPError:
return "# ERROR: Could not contact queue. Please try again in a few minutes."
except:
return "# ERROR: Unexpected error. Please try again later."
return "# SUCCESS: Please wait up to 24 hours for your model to be added to the queue."
with gr.Blocks() as demo:
gr.HTML('<style>.tab-buttons button{font-size:1.3em}</style><h1 style="text-align:center">Subquadratic LLM Leaderboard</h1>')
with gr.Tabs(elem_classes="tab-buttons") as tabs:
with gr.Tab("πŸ… LLM Benchmark"):
gr.Markdown("Table filters under construction")
gr.Dataframe("data.csv")
with gr.Tab("πŸ“ About"):
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.
This leaderboard is maintained by Devin Gulliver and is still under construction, check back regularly for further improvements!
""")
with gr.Tab("πŸš€ Submit here!"):
with gr.Group():
with gr.Row():
model_name = gr.Textbox(max_lines=1, label="Model Name", scale=4)
submit = gr.Button("Submit", variant="primary", scale=0)
output = gr.Markdown("Enter a public HF repo id, then hit Submit to add it to the evaluation queue.")
submit.click(fn=submit_model, inputs=model_name, outputs=output)
demo.launch()