Spaces:
Sleeping
Sleeping
Update space
Browse files
app.py
CHANGED
@@ -6,7 +6,7 @@ from apscheduler.schedulers.background import BackgroundScheduler
|
|
6 |
|
7 |
from src.envs import API, REPO_ID, TOKEN
|
8 |
|
9 |
-
from utils import get_data, submit, refresh
|
10 |
|
11 |
|
12 |
def restart_space():
|
@@ -48,6 +48,8 @@ table > tbody > tr > td:nth-child(2) > div {
|
|
48 |
|
49 |
"""
|
50 |
|
|
|
|
|
51 |
# create Gradio interface
|
52 |
with gr.Blocks() as demo:
|
53 |
gr.Markdown("# π€ InfoSearch Benchmark Leaderboard")
|
@@ -61,8 +63,26 @@ with gr.Blocks() as demo:
|
|
61 |
datatype=data_type,
|
62 |
interactive=False, elem_classes=["fixed-height-table"])
|
63 |
with gr.TabItem("π Submit here!"):
|
64 |
-
gr.
|
65 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
66 |
submit_button = gr.Button("Submit")
|
67 |
submission_result = gr.Markdown()
|
68 |
submit_button.click(submit, file_upload, submission_result)
|
@@ -73,4 +93,4 @@ logging.getLogger('apscheduler').setLevel(logging.DEBUG)
|
|
73 |
scheduler = BackgroundScheduler()
|
74 |
scheduler.add_job(restart_space, "interval", seconds=3600)
|
75 |
scheduler.start()
|
76 |
-
demo.queue(default_concurrency_limit=40).launch()
|
|
|
6 |
|
7 |
from src.envs import API, REPO_ID, TOKEN
|
8 |
|
9 |
+
from utils import get_data, submit, refresh, get_submission_data
|
10 |
|
11 |
|
12 |
def restart_space():
|
|
|
48 |
|
49 |
"""
|
50 |
|
51 |
+
submitting_queue_df = get_submission_data()
|
52 |
+
|
53 |
# create Gradio interface
|
54 |
with gr.Blocks() as demo:
|
55 |
gr.Markdown("# π€ InfoSearch Benchmark Leaderboard")
|
|
|
63 |
datatype=data_type,
|
64 |
interactive=False, elem_classes=["fixed-height-table"])
|
65 |
with gr.TabItem("π Submit here!"):
|
66 |
+
with gr.Column():
|
67 |
+
with gr.Row():
|
68 |
+
gr.Markdown("README")
|
69 |
+
|
70 |
+
with gr.Column():
|
71 |
+
with gr.Accordion(f"π Submitting Queue ({len(submitting_queue_df)})", open=False):
|
72 |
+
with gr.Row():
|
73 |
+
submitting_table = gr.components.Dataframe(
|
74 |
+
value=submitting_queue_df,
|
75 |
+
headers=["Model"],
|
76 |
+
datatype=["markdown"],
|
77 |
+
row_count=5,
|
78 |
+
)
|
79 |
+
|
80 |
+
with gr.Row():
|
81 |
+
gr.Markdown("# βοΈβ¨ Submit your evaluation results here.")
|
82 |
+
|
83 |
+
with gr.Row():
|
84 |
+
file_upload = gr.File(label="Upload your JSON file", data_type=["json"])
|
85 |
+
|
86 |
submit_button = gr.Button("Submit")
|
87 |
submission_result = gr.Markdown()
|
88 |
submit_button.click(submit, file_upload, submission_result)
|
|
|
93 |
scheduler = BackgroundScheduler()
|
94 |
scheduler.add_job(restart_space, "interval", seconds=3600)
|
95 |
scheduler.start()
|
96 |
+
demo.queue(default_concurrency_limit=40).launch()
|
utils.py
CHANGED
@@ -55,6 +55,15 @@ def get_data(dimension):
|
|
55 |
return pd.DataFrame(data)
|
56 |
|
57 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
58 |
def submit(json_file):
|
59 |
flag, message = check_json_file(json_file)
|
60 |
if flag:
|
@@ -144,4 +153,5 @@ def check_json_file(json_file):
|
|
144 |
|
145 |
|
146 |
def is_empty(dir_path):
|
147 |
-
|
|
|
|
55 |
return pd.DataFrame(data)
|
56 |
|
57 |
|
58 |
+
def get_submission_data():
|
59 |
+
if is_empty("temp"):
|
60 |
+
return pd.DataFrame()
|
61 |
+
data = []
|
62 |
+
with open("temp/Audience.jsonl", "r") as f:
|
63 |
+
data.extend([json.loads(line) for line in f])
|
64 |
+
return pd.DataFrame(data)
|
65 |
+
|
66 |
+
|
67 |
def submit(json_file):
|
68 |
flag, message = check_json_file(json_file)
|
69 |
if flag:
|
|
|
153 |
|
154 |
|
155 |
def is_empty(dir_path):
|
156 |
+
# check if the directory contains jsonl files
|
157 |
+
return not any([f.endswith(".jsonl") for f in os.listdir(dir_path)])
|