Spaces:
Running
Running
Show pre-submit leaderboard and model tournament table and buttons for CSV
Browse files
app.py
CHANGED
@@ -2,7 +2,6 @@ import os
|
|
2 |
|
3 |
import regex as re
|
4 |
import gradio as gr
|
5 |
-
import pandas as pd
|
6 |
from gradio.themes.utils.sizes import text_md
|
7 |
from gradio_modal import Modal
|
8 |
|
@@ -83,6 +82,9 @@ def process_submission(*inputs):
|
|
83 |
gr.update(visible=False),
|
84 |
gr.update(visible=False),
|
85 |
gr.update(visible=False),
|
|
|
|
|
|
|
86 |
)
|
87 |
except Exception as err:
|
88 |
gr.Warning(str(err), duration=None)
|
@@ -93,6 +95,9 @@ def process_submission(*inputs):
|
|
93 |
gr.update(visible=False),
|
94 |
gr.update(visible=False),
|
95 |
gr.update(visible=False),
|
|
|
|
|
|
|
96 |
)
|
97 |
|
98 |
gr.Info('Tournament finished!', duration=5)
|
@@ -105,18 +110,36 @@ def process_submission(*inputs):
|
|
105 |
submit_prompt = gr.update(visible=True)
|
106 |
submission_btn_yes = gr.update(interactive=True, visible=True)
|
107 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
108 |
return (
|
109 |
gr.update(visible=False),
|
110 |
submit_prompt,
|
111 |
submission_btn_yes,
|
112 |
gr.update(interactive=True, visible=True),
|
113 |
gr.update(visible=True),
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
elem_classes="leaderboard-table",
|
119 |
-
),
|
120 |
)
|
121 |
|
122 |
def get_submission_ids_and_titles():
|
@@ -155,6 +178,9 @@ def submit_results():
|
|
155 |
gr.update(visible=False),
|
156 |
gr.update(visible=False),
|
157 |
gr.update(visible=False),
|
|
|
|
|
|
|
158 |
leaderboard,
|
159 |
leaderboard_csv,
|
160 |
gr.update(visible=False),
|
@@ -176,6 +202,9 @@ def erase_pre_submit():
|
|
176 |
gr.update(visible=False),
|
177 |
gr.update(visible=False),
|
178 |
gr.update(visible=False),
|
|
|
|
|
|
|
179 |
)
|
180 |
|
181 |
|
@@ -783,9 +812,35 @@ def gradio_app():
|
|
783 |
RANKING_AFTER_SUBMISSION_MARKDOWN,
|
784 |
visible=False
|
785 |
)
|
786 |
-
|
787 |
-
|
788 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
789 |
submission_btn_yes = gr.Button(value='Submit model', interactive=False, visible=False)
|
790 |
submission_btn_no = gr.Button(value='Reverse process', interactive=False, visible=False)
|
791 |
|
@@ -806,7 +861,10 @@ def gradio_app():
|
|
806 |
submission_btn_yes,
|
807 |
submission_btn_no,
|
808 |
pre_submit_info,
|
809 |
-
|
|
|
|
|
|
|
810 |
],
|
811 |
concurrency_limit=None,
|
812 |
)
|
@@ -830,7 +888,10 @@ def gradio_app():
|
|
830 |
submission_btn_no,
|
831 |
submit_prompt,
|
832 |
pre_submit_info,
|
833 |
-
|
|
|
|
|
|
|
834 |
leaderboard_table,
|
835 |
leaderboard_table_csv,
|
836 |
modal_submit,
|
@@ -871,7 +932,10 @@ def gradio_app():
|
|
871 |
submission_btn_no,
|
872 |
submit_prompt,
|
873 |
pre_submit_info,
|
874 |
-
|
|
|
|
|
|
|
875 |
],
|
876 |
)
|
877 |
|
|
|
2 |
|
3 |
import regex as re
|
4 |
import gradio as gr
|
|
|
5 |
from gradio.themes.utils.sizes import text_md
|
6 |
from gradio_modal import Modal
|
7 |
|
|
|
82 |
gr.update(visible=False),
|
83 |
gr.update(visible=False),
|
84 |
gr.update(visible=False),
|
85 |
+
gr.update(visible=False),
|
86 |
+
gr.update(visible=False),
|
87 |
+
gr.update(visible=False),
|
88 |
)
|
89 |
except Exception as err:
|
90 |
gr.Warning(str(err), duration=None)
|
|
|
95 |
gr.update(visible=False),
|
96 |
gr.update(visible=False),
|
97 |
gr.update(visible=False),
|
98 |
+
gr.update(visible=False),
|
99 |
+
gr.update(visible=False),
|
100 |
+
gr.update(visible=False),
|
101 |
)
|
102 |
|
103 |
gr.Info('Tournament finished!', duration=5)
|
|
|
110 |
submit_prompt = gr.update(visible=True)
|
111 |
submission_btn_yes = gr.update(interactive=True, visible=True)
|
112 |
|
113 |
+
pre_submit_leaderboard_table = gr.update(
|
114 |
+
value=leaderboard_server.get_leaderboard(pre_submit=pre_submit, category=leaderboard_server.TASKS_CATEGORY_OVERALL_DETAILS),
|
115 |
+
visible=True,
|
116 |
+
)
|
117 |
+
|
118 |
+
pre_submit_leaderboard_table_csv = gr.update(
|
119 |
+
value=leaderboard_server.get_leaderboard_csv(pre_submit=pre_submit, category=leaderboard_server.TASKS_CATEGORY_OVERALL_DETAILS),
|
120 |
+
visible=True,
|
121 |
+
)
|
122 |
+
|
123 |
+
pre_submit_model_tournament_results_table = gr.update(
|
124 |
+
value=leaderboard_server.get_model_tournament_table(pre_submit.submission_id, leaderboard_server.TASKS_CATEGORY_OVERALL_DETAILS, pre_submit=pre_submit),
|
125 |
+
visible=True,
|
126 |
+
)
|
127 |
+
|
128 |
+
pre_submit_model_tournament_results_table_csv = gr.update(
|
129 |
+
value=leaderboard_server.get_model_tournament_table_csv(pre_submit.submission_id, leaderboard_server.TASKS_CATEGORY_OVERALL_DETAILS, pre_submit=pre_submit),
|
130 |
+
visible=True,
|
131 |
+
)
|
132 |
+
|
133 |
return (
|
134 |
gr.update(visible=False),
|
135 |
submit_prompt,
|
136 |
submission_btn_yes,
|
137 |
gr.update(interactive=True, visible=True),
|
138 |
gr.update(visible=True),
|
139 |
+
pre_submit_leaderboard_table,
|
140 |
+
pre_submit_leaderboard_table_csv,
|
141 |
+
pre_submit_model_tournament_results_table,
|
142 |
+
pre_submit_model_tournament_results_table_csv,
|
|
|
|
|
143 |
)
|
144 |
|
145 |
def get_submission_ids_and_titles():
|
|
|
178 |
gr.update(visible=False),
|
179 |
gr.update(visible=False),
|
180 |
gr.update(visible=False),
|
181 |
+
gr.update(visible=False),
|
182 |
+
gr.update(visible=False),
|
183 |
+
gr.update(visible=False),
|
184 |
leaderboard,
|
185 |
leaderboard_csv,
|
186 |
gr.update(visible=False),
|
|
|
202 |
gr.update(visible=False),
|
203 |
gr.update(visible=False),
|
204 |
gr.update(visible=False),
|
205 |
+
gr.update(visible=False),
|
206 |
+
gr.update(visible=False),
|
207 |
+
gr.update(visible=False),
|
208 |
)
|
209 |
|
210 |
|
|
|
812 |
RANKING_AFTER_SUBMISSION_MARKDOWN,
|
813 |
visible=False
|
814 |
)
|
815 |
+
|
816 |
+
pre_submit_leaderboard_table = gr.DataFrame(
|
817 |
+
value=None,
|
818 |
+
datatype="markdown",
|
819 |
+
label="The leaderboard for this pre-submission",
|
820 |
+
visible=False,
|
821 |
+
interactive=False,
|
822 |
+
elem_classes="leaderboard-table",
|
823 |
+
)
|
824 |
+
|
825 |
+
pre_submit_leaderboard_table_csv = gr.DownloadButton(
|
826 |
+
label="Download the leaderboard in CSV format",
|
827 |
+
visible=False,
|
828 |
+
)
|
829 |
+
|
830 |
+
pre_submit_model_tournament_results_table = gr.DataFrame(
|
831 |
+
value=None,
|
832 |
+
datatype="markdown",
|
833 |
+
label="The pre-submited model won against…",
|
834 |
+
visible=False,
|
835 |
+
interactive=False,
|
836 |
+
elem_classes="leaderboard-table-model-details",
|
837 |
+
)
|
838 |
+
|
839 |
+
pre_submit_model_tournament_results_table_csv = gr.DownloadButton(
|
840 |
+
label="Download the model tournament results in CSV format",
|
841 |
+
visible=False,
|
842 |
+
)
|
843 |
+
|
844 |
submission_btn_yes = gr.Button(value='Submit model', interactive=False, visible=False)
|
845 |
submission_btn_no = gr.Button(value='Reverse process', interactive=False, visible=False)
|
846 |
|
|
|
861 |
submission_btn_yes,
|
862 |
submission_btn_no,
|
863 |
pre_submit_info,
|
864 |
+
pre_submit_leaderboard_table,
|
865 |
+
pre_submit_leaderboard_table_csv,
|
866 |
+
pre_submit_model_tournament_results_table,
|
867 |
+
pre_submit_model_tournament_results_table_csv,
|
868 |
],
|
869 |
concurrency_limit=None,
|
870 |
)
|
|
|
888 |
submission_btn_no,
|
889 |
submit_prompt,
|
890 |
pre_submit_info,
|
891 |
+
pre_submit_leaderboard_table,
|
892 |
+
pre_submit_leaderboard_table_csv,
|
893 |
+
pre_submit_model_tournament_results_table,
|
894 |
+
pre_submit_model_tournament_results_table_csv,
|
895 |
leaderboard_table,
|
896 |
leaderboard_table_csv,
|
897 |
modal_submit,
|
|
|
932 |
submission_btn_no,
|
933 |
submit_prompt,
|
934 |
pre_submit_info,
|
935 |
+
pre_submit_leaderboard_table,
|
936 |
+
pre_submit_leaderboard_table_csv,
|
937 |
+
pre_submit_model_tournament_results_table,
|
938 |
+
pre_submit_model_tournament_results_table_csv,
|
939 |
],
|
940 |
)
|
941 |
|