Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
File size: 1,571 Bytes
dcda545 951acfe dcda545 951acfe dcda545 951acfe dcda545 017433f dcda545 017433f 73ef9a8 951acfe a65cccd 951acfe 73ef9a8 951acfe 73ef9a8 dcda545 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
import gradio as gr
from gradio_leaderboard import Leaderboard, SelectColumns, ColumnFilter
import config
from pathlib import Path
import pandas as pd
import random
abs_path = Path(__file__).parent
df = pd.read_json(str(abs_path / "leaderboard_data.json"))
# Randomly set True/ False for the "MOE" column
df["MOE"] = [random.random() > 0.5 for _ in range(len(df))]
df["Flagged"] = [random.random() > 0.5 for _ in range(len(df))]
with gr.Blocks() as demo:
gr.Markdown("""
# 🥇 Leaderboard Component
""")
with gr.Tabs():
with gr.Tab("Demo"):
Leaderboard(
value=df,
select_columns=SelectColumns(
default_selection=config.ON_LOAD_COLUMNS,
cant_deselect=["T", "Model"],
label="Select Columns to Display:",
),
search_columns=["model_name_for_query", "Type"],
hide_columns=["model_name_for_query", "Model Size"],
filter_columns=[
"T",
"Precision",
ColumnFilter("MOE", type="boolean", default=False, label="MoE"),
ColumnFilter("Flagged", type="boolean", default=False),
ColumnFilter("#Params (B)", default=[30, 80]),
],
datatype=config.TYPES,
column_widths=["2%", "33%"],
)
with gr.Tab("Docs"):
gr.Markdown((Path(__file__).parent / "docs.md").read_text())
if __name__ == "__main__":
demo.launch()
|