Spaces:
Sleeping
Sleeping
File size: 2,942 Bytes
7dec9fd 8854819 7dec9fd ee9a738 9d57a1e ee9a738 8aa46a3 7dec9fd 6abce40 7dec9fd ee9a738 8aa46a3 ee9a738 8aa46a3 161ad85 8aa46a3 ee9a738 7dec9fd ee9a738 7dec9fd 8854819 7dec9fd c36f3d8 7dec9fd 8aa46a3 |
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 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 |
import gradio as gr
from gradio_leaderboard import Leaderboard, ColumnFilter, SelectColumns
import pandas as pd
import logging
from apscheduler.schedulers.background import BackgroundScheduler
from src.envs import API, REPO_ID, TOKEN
from utils import get_data, submit, refresh, get_submission_data
def restart_space():
refresh()
API.restart_space(repo_id=REPO_ID)
dimensions = ['Audience', 'Keyword', 'Format', 'Language', 'Length', 'Source']
display_columns = [
"Rank", "Model", "WISE", "SICR", "nDCG@10(Original)", "nDCG@10(Instructed)",
"nDCG@10(Reversely Instructed)", "MRR@1(Original)", "MRR@1(Instructed)",
"MRR@1(Reversely Instructed)"
]
data_type = ["number", "markdown", "number", "number", "number", "number", "number", "number", "number", "number"]
css = """
table > thead {
white-space: normal
}
table {
--cell-width-1: 250px
}
table > tbody > tr > td:nth-child(2) > div {
overflow-x: auto
}
.filter-checkbox-group {
max-width: max-content;
}
.fixed-height-table {
height: 100px;
overflow-y: scroll;
}
"""
submitting_queue_df = get_submission_data()
# create Gradio interface
with gr.Blocks() as demo:
gr.Markdown("# π€ InfoSearch Benchmark Leaderboard")
with gr.Tabs() as tabs:
with gr.TabItem("π
InfoSearch Benchmark"):
for dimension in dimensions:
with gr.Tab(dimension):
data = get_data(f"{dimension}")
gr.Dataframe(data,
headers=display_columns,
datatype=data_type,
interactive=False, elem_classes=["fixed-height-table"])
with gr.TabItem("π Submit here!"):
with gr.Column():
with gr.Row():
gr.Markdown("README")
with gr.Column():
with gr.Accordion(f"π Submitting Queue ({len(submitting_queue_df)})", open=False):
with gr.Row():
submitting_table = gr.components.Dataframe(
value=submitting_queue_df,
headers=["Model"],
datatype=["markdown"],
row_count=5,
)
with gr.Row():
gr.Markdown("# βοΈβ¨ Submit your evaluation results here.")
with gr.Row():
file_upload = gr.File(label="Upload your JSON file")
submit_button = gr.Button("Submit")
submission_result = gr.Markdown()
submit_button.click(submit, file_upload, submission_result)
logging.basicConfig()
logging.getLogger('apscheduler').setLevel(logging.DEBUG)
scheduler = BackgroundScheduler()
scheduler.add_job(restart_space, "interval", seconds=300)
scheduler.start()
demo.queue(default_concurrency_limit=40).launch()
|