Add a separate textbox for model url and toss textboxes around
Browse files- app.py +11 -4
- src/formatting.py +4 -0
- src/get_results_for_task.py +9 -2
- src/submission_uploader.py +10 -0
app.py
CHANGED
@@ -69,6 +69,16 @@ with gr.Blocks() as demo:
|
|
69 |
label="Model Name",
|
70 |
placeholder="How to display model's name on the leaderboard.",
|
71 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
72 |
model_availability_textbox = gr.Textbox(
|
73 |
label="Availability",
|
74 |
placeholder="Information about the model's availability and licensing.",
|
@@ -82,10 +92,6 @@ with gr.Blocks() as demo:
|
|
82 |
label="Submitted By",
|
83 |
placeholder="How to display on the leaderboard who submitted the model.",
|
84 |
)
|
85 |
-
url_textbox = gr.Textbox(
|
86 |
-
label="Relevant URLs",
|
87 |
-
placeholder="URLs to relevant resources with additional details about your submission (optional).",
|
88 |
-
)
|
89 |
contact_textbox = gr.Textbox(
|
90 |
label="Contact Information",
|
91 |
placeholder="How Long Code Arena team can contact you (won't go to public dataset).",
|
@@ -110,6 +116,7 @@ with gr.Blocks() as demo:
|
|
110 |
model_folder_textbox,
|
111 |
model_name_textbox,
|
112 |
model_availability_textbox,
|
|
|
113 |
url_textbox,
|
114 |
context_size_textbox,
|
115 |
submitted_by_textbox,
|
|
|
69 |
label="Model Name",
|
70 |
placeholder="How to display model's name on the leaderboard.",
|
71 |
)
|
72 |
+
model_url_textbox = gr.Textbox(
|
73 |
+
label="Model URL",
|
74 |
+
placeholder="Link to a model's page - will be clickable on a leaderboard (optional).",
|
75 |
+
)
|
76 |
+
|
77 |
+
with gr.Column():
|
78 |
+
url_textbox = gr.Textbox(
|
79 |
+
label="Relevant URLs",
|
80 |
+
placeholder="URLs to relevant resources with additional details about your submission (optional).",
|
81 |
+
)
|
82 |
model_availability_textbox = gr.Textbox(
|
83 |
label="Availability",
|
84 |
placeholder="Information about the model's availability and licensing.",
|
|
|
92 |
label="Submitted By",
|
93 |
placeholder="How to display on the leaderboard who submitted the model.",
|
94 |
)
|
|
|
|
|
|
|
|
|
95 |
contact_textbox = gr.Textbox(
|
96 |
label="Contact Information",
|
97 |
placeholder="How Long Code Arena team can contact you (won't go to public dataset).",
|
|
|
116 |
model_folder_textbox,
|
117 |
model_name_textbox,
|
118 |
model_availability_textbox,
|
119 |
+
model_url_textbox,
|
120 |
url_textbox,
|
121 |
context_size_textbox,
|
122 |
submitted_by_textbox,
|
src/formatting.py
CHANGED
@@ -8,3 +8,7 @@ def styled_warning(warn):
|
|
8 |
|
9 |
def styled_message(message):
|
10 |
return f"<p style='color: green; font-size: 20px; text-align: center;'>{message}</p>"
|
|
|
|
|
|
|
|
|
|
8 |
|
9 |
def styled_message(message):
|
10 |
return f"<p style='color: green; font-size: 20px; text-align: center;'>{message}</p>"
|
11 |
+
|
12 |
+
|
13 |
+
def model_hyperlink(link, model_name):
|
14 |
+
return f'<a target="_blank" href="{link}" style="color: var(--link-text-color); text-decoration: underline;text-decoration-style: dotted;">{model_name}</a>'
|
src/get_results_for_task.py
CHANGED
@@ -4,6 +4,7 @@ import os
|
|
4 |
import pandas as pd # type: ignore[import]
|
5 |
from datasets import get_dataset_config_names, load_dataset # type: ignore[import]
|
6 |
|
|
|
7 |
from .leaderboard_formatting import (
|
8 |
COLUMNS_PRETTY,
|
9 |
METRICS_PER_TASK,
|
@@ -12,8 +13,10 @@ from .leaderboard_formatting import (
|
|
12 |
)
|
13 |
from .tasks_content import TASKS_PRETTY_REVERSE
|
14 |
|
15 |
-
|
16 |
-
|
|
|
|
|
17 |
|
18 |
def _get_results_stub() -> pd.DataFrame:
|
19 |
stub_df = pd.DataFrame(
|
@@ -58,6 +61,10 @@ def _get_results_dataset(task_id: str) -> pd.DataFrame:
|
|
58 |
else:
|
59 |
results_df[metric_column] = results_df[metric_column].map(lambda x: f"{x:.2f}")
|
60 |
|
|
|
|
|
|
|
|
|
61 |
results_df = results_df[get_columns_per_task(task_id)]
|
62 |
return results_df
|
63 |
|
|
|
4 |
import pandas as pd # type: ignore[import]
|
5 |
from datasets import get_dataset_config_names, load_dataset # type: ignore[import]
|
6 |
|
7 |
+
from .formatting import model_hyperlink
|
8 |
from .leaderboard_formatting import (
|
9 |
COLUMNS_PRETTY,
|
10 |
METRICS_PER_TASK,
|
|
|
13 |
)
|
14 |
from .tasks_content import TASKS_PRETTY_REVERSE
|
15 |
|
16 |
+
try:
|
17 |
+
AVAILABLE_TASKS = get_dataset_config_names(os.environ["DATASET_ID"])
|
18 |
+
except FileNotFoundError:
|
19 |
+
AVAILABLE_TASKS = []
|
20 |
|
21 |
def _get_results_stub() -> pd.DataFrame:
|
22 |
stub_df = pd.DataFrame(
|
|
|
61 |
else:
|
62 |
results_df[metric_column] = results_df[metric_column].map(lambda x: f"{x:.2f}")
|
63 |
|
64 |
+
results_df["Model Name"] = [
|
65 |
+
model_hyperlink(link=link, model_name=model_name) if link else model_name
|
66 |
+
for link, model_name in zip(results_df["model_url"], results_df["Model Name"])
|
67 |
+
]
|
68 |
results_df = results_df[get_columns_per_task(task_id)]
|
69 |
return results_df
|
70 |
|
src/submission_uploader.py
CHANGED
@@ -25,6 +25,7 @@ class SubmissionUploader:
|
|
25 |
Heavily influenced by these amazing spaces:
|
26 |
* https://huggingface.co/spaces/safetensors/convert
|
27 |
* https://huggingface.co/spaces/gaia-benchmark/leaderboard
|
|
|
28 |
"""
|
29 |
|
30 |
def __init__(self, dataset_id: str, private_dataset_id: str):
|
@@ -50,6 +51,7 @@ class SubmissionUploader:
|
|
50 |
model_folder: str,
|
51 |
model_name_pretty: str,
|
52 |
model_availability: str,
|
|
|
53 |
urls: Optional[str],
|
54 |
context_size: str,
|
55 |
submitted_by: str,
|
@@ -63,6 +65,7 @@ class SubmissionUploader:
|
|
63 |
"model_folder": model_folder,
|
64 |
"model_name_pretty": model_name_pretty,
|
65 |
"model_availability": model_availability,
|
|
|
66 |
"urls": urls,
|
67 |
"context_size": context_size,
|
68 |
"submitted_by": submitted_by,
|
@@ -139,6 +142,7 @@ class SubmissionUploader:
|
|
139 |
model_folder: str,
|
140 |
model_name_pretty: str,
|
141 |
model_availability: str,
|
|
|
142 |
urls: Optional[str],
|
143 |
context_size: str,
|
144 |
submitted_by: str,
|
@@ -153,6 +157,7 @@ class SubmissionUploader:
|
|
153 |
{
|
154 |
"model_name": model_name_pretty,
|
155 |
"model_availability": model_availability,
|
|
|
156 |
"urls": urls,
|
157 |
"context_size": context_size,
|
158 |
"submitted_by": submitted_by,
|
@@ -175,6 +180,7 @@ class SubmissionUploader:
|
|
175 |
model_folder: str,
|
176 |
model_name_pretty: str,
|
177 |
model_availability: str,
|
|
|
178 |
urls: Optional[str],
|
179 |
context_size: str,
|
180 |
submitted_by: str,
|
@@ -203,6 +209,7 @@ class SubmissionUploader:
|
|
203 |
model_folder: str,
|
204 |
model_name_pretty: str,
|
205 |
model_availability: str,
|
|
|
206 |
urls: Optional[str],
|
207 |
context_size: str,
|
208 |
submitted_by: str,
|
@@ -217,6 +224,7 @@ class SubmissionUploader:
|
|
217 |
model_folder=model_folder,
|
218 |
model_name_pretty=model_name_pretty,
|
219 |
model_availability=model_availability,
|
|
|
220 |
urls=urls,
|
221 |
context_size=context_size,
|
222 |
submitted_by=submitted_by,
|
@@ -261,6 +269,7 @@ class SubmissionUploader:
|
|
261 |
model_folder=model_folder,
|
262 |
model_name_pretty=model_name_pretty,
|
263 |
model_availability=model_availability,
|
|
|
264 |
urls=urls,
|
265 |
context_size=context_size,
|
266 |
submitted_by=submitted_by,
|
@@ -284,6 +293,7 @@ class SubmissionUploader:
|
|
284 |
temp_directory=str(d),
|
285 |
model_name_pretty=model_name_pretty,
|
286 |
model_availability=model_availability,
|
|
|
287 |
urls=urls,
|
288 |
context_size=context_size,
|
289 |
submitted_by=submitted_by,
|
|
|
25 |
Heavily influenced by these amazing spaces:
|
26 |
* https://huggingface.co/spaces/safetensors/convert
|
27 |
* https://huggingface.co/spaces/gaia-benchmark/leaderboard
|
28 |
+
* https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard
|
29 |
"""
|
30 |
|
31 |
def __init__(self, dataset_id: str, private_dataset_id: str):
|
|
|
51 |
model_folder: str,
|
52 |
model_name_pretty: str,
|
53 |
model_availability: str,
|
54 |
+
model_url: Optional[str],
|
55 |
urls: Optional[str],
|
56 |
context_size: str,
|
57 |
submitted_by: str,
|
|
|
65 |
"model_folder": model_folder,
|
66 |
"model_name_pretty": model_name_pretty,
|
67 |
"model_availability": model_availability,
|
68 |
+
"model_url": model_url,
|
69 |
"urls": urls,
|
70 |
"context_size": context_size,
|
71 |
"submitted_by": submitted_by,
|
|
|
142 |
model_folder: str,
|
143 |
model_name_pretty: str,
|
144 |
model_availability: str,
|
145 |
+
model_url: Optional[str],
|
146 |
urls: Optional[str],
|
147 |
context_size: str,
|
148 |
submitted_by: str,
|
|
|
157 |
{
|
158 |
"model_name": model_name_pretty,
|
159 |
"model_availability": model_availability,
|
160 |
+
"model_url": model_url,
|
161 |
"urls": urls,
|
162 |
"context_size": context_size,
|
163 |
"submitted_by": submitted_by,
|
|
|
180 |
model_folder: str,
|
181 |
model_name_pretty: str,
|
182 |
model_availability: str,
|
183 |
+
model_url: Optional[str],
|
184 |
urls: Optional[str],
|
185 |
context_size: str,
|
186 |
submitted_by: str,
|
|
|
209 |
model_folder: str,
|
210 |
model_name_pretty: str,
|
211 |
model_availability: str,
|
212 |
+
model_url: Optional[str],
|
213 |
urls: Optional[str],
|
214 |
context_size: str,
|
215 |
submitted_by: str,
|
|
|
224 |
model_folder=model_folder,
|
225 |
model_name_pretty=model_name_pretty,
|
226 |
model_availability=model_availability,
|
227 |
+
model_url=model_url,
|
228 |
urls=urls,
|
229 |
context_size=context_size,
|
230 |
submitted_by=submitted_by,
|
|
|
269 |
model_folder=model_folder,
|
270 |
model_name_pretty=model_name_pretty,
|
271 |
model_availability=model_availability,
|
272 |
+
model_url=model_url,
|
273 |
urls=urls,
|
274 |
context_size=context_size,
|
275 |
submitted_by=submitted_by,
|
|
|
293 |
temp_directory=str(d),
|
294 |
model_name_pretty=model_name_pretty,
|
295 |
model_availability=model_availability,
|
296 |
+
model_url=model_url,
|
297 |
urls=urls,
|
298 |
context_size=context_size,
|
299 |
submitted_by=submitted_by,
|