Maria Castellanos
commited on
Commit
·
960994d
1
Parent(s):
15713eb
make first working version
Browse files- app.py +6 -6
- evaluate.py +4 -3
app.py
CHANGED
|
@@ -10,13 +10,13 @@ from datetime import datetime
|
|
| 10 |
from about import ENDPOINTS
|
| 11 |
|
| 12 |
|
| 13 |
-
def get_leaderboard(
|
| 14 |
dset = load_dataset(results_repo, split='train', download_mode="force_redownload")
|
| 15 |
-
full_df =
|
| 16 |
to_show = full_df.copy(deep=True)
|
| 17 |
-
to_show = to_show[to_show['
|
| 18 |
# The columns to display publicly
|
| 19 |
-
to_show = to_show[["user", "
|
| 20 |
|
| 21 |
return to_show
|
| 22 |
|
|
@@ -117,7 +117,7 @@ def gradio_interface():
|
|
| 117 |
df = mock_data[i]
|
| 118 |
with gr.TabItem(endpoint):
|
| 119 |
Leaderboard(
|
| 120 |
-
value=
|
| 121 |
datatype=['str', 'number', 'number', 'number', 'number'],
|
| 122 |
select_columns=["user", "MAE", "R2", "Spearman R", "Kendall's Tau"],
|
| 123 |
search_columns=["user"],
|
|
@@ -204,7 +204,7 @@ def gradio_interface():
|
|
| 204 |
submit_btn.click(
|
| 205 |
submit_data,
|
| 206 |
inputs=[predictions_file, user_state, participant_name, discord_username, email, affiliation],
|
| 207 |
-
outputs=[message],
|
| 208 |
).success(
|
| 209 |
fn=lambda m: gr.update(value=m, visible=True),
|
| 210 |
inputs=[message],
|
|
|
|
| 10 |
from about import ENDPOINTS
|
| 11 |
|
| 12 |
|
| 13 |
+
def get_leaderboard(endpoint):
|
| 14 |
dset = load_dataset(results_repo, split='train', download_mode="force_redownload")
|
| 15 |
+
full_df = dset.to_pandas()
|
| 16 |
to_show = full_df.copy(deep=True)
|
| 17 |
+
to_show = to_show[to_show['endpoint'] == endpoint]
|
| 18 |
# The columns to display publicly
|
| 19 |
+
to_show = to_show[["user", "MAE", "R2", "Spearman R", "Kendall's Tau"]]
|
| 20 |
|
| 21 |
return to_show
|
| 22 |
|
|
|
|
| 117 |
df = mock_data[i]
|
| 118 |
with gr.TabItem(endpoint):
|
| 119 |
Leaderboard(
|
| 120 |
+
value=get_leaderboard(endpoint),
|
| 121 |
datatype=['str', 'number', 'number', 'number', 'number'],
|
| 122 |
select_columns=["user", "MAE", "R2", "Spearman R", "Kendall's Tau"],
|
| 123 |
search_columns=["user"],
|
|
|
|
| 204 |
submit_btn.click(
|
| 205 |
submit_data,
|
| 206 |
inputs=[predictions_file, user_state, participant_name, discord_username, email, affiliation],
|
| 207 |
+
outputs=[message, filename],
|
| 208 |
).success(
|
| 209 |
fn=lambda m: gr.update(value=m, visible=True),
|
| 210 |
inputs=[message],
|
evaluate.py
CHANGED
|
@@ -18,11 +18,11 @@ class ParticipantRecord(pydantic.BaseModel):
|
|
| 18 |
discord_username: Optional[str] = pydantic.Field(default=None, description="Discord username")
|
| 19 |
email: Optional[str] = pydantic.Field(default=None, description="Email address")
|
| 20 |
affiliation: Optional[str] = pydantic.Field(default=None, description="Affiliation")
|
| 21 |
-
model_tag: Optional[str] = pydantic.Field(default=None, description="Model tag")
|
| 22 |
|
| 23 |
|
| 24 |
class SubmissionMetadata(pydantic.BaseModel):
|
| 25 |
-
submission_time_utc:
|
| 26 |
user: str
|
| 27 |
original_filename: str
|
| 28 |
evaluated: bool
|
|
@@ -96,6 +96,7 @@ def submit_data(predictions_file: str,
|
|
| 96 |
try:
|
| 97 |
meta = SubmissionMetadata(
|
| 98 |
submission_time_utc=ts,
|
|
|
|
| 99 |
original_filename=file_path.name,
|
| 100 |
evaluated=False,
|
| 101 |
participant=participant_record
|
|
@@ -132,7 +133,7 @@ def evaluate_data(filename: str) -> None:
|
|
| 132 |
test_path = hf_hub_download(
|
| 133 |
repo_id=test_repo,
|
| 134 |
repo_type="dataset",
|
| 135 |
-
filename="data/test_dataset.csv"
|
| 136 |
)
|
| 137 |
except Exception as e:
|
| 138 |
raise gr.Error(f"Failed to download test file: {e}")
|
|
|
|
| 18 |
discord_username: Optional[str] = pydantic.Field(default=None, description="Discord username")
|
| 19 |
email: Optional[str] = pydantic.Field(default=None, description="Email address")
|
| 20 |
affiliation: Optional[str] = pydantic.Field(default=None, description="Affiliation")
|
| 21 |
+
#model_tag: Optional[str] = pydantic.Field(default=None, description="Model tag")
|
| 22 |
|
| 23 |
|
| 24 |
class SubmissionMetadata(pydantic.BaseModel):
|
| 25 |
+
submission_time_utc: str
|
| 26 |
user: str
|
| 27 |
original_filename: str
|
| 28 |
evaluated: bool
|
|
|
|
| 96 |
try:
|
| 97 |
meta = SubmissionMetadata(
|
| 98 |
submission_time_utc=ts,
|
| 99 |
+
user=user_state,
|
| 100 |
original_filename=file_path.name,
|
| 101 |
evaluated=False,
|
| 102 |
participant=participant_record
|
|
|
|
| 133 |
test_path = hf_hub_download(
|
| 134 |
repo_id=test_repo,
|
| 135 |
repo_type="dataset",
|
| 136 |
+
filename="data/challenge_mock_test_set.csv", #Replace later with "test_dataset.csv" later!!,
|
| 137 |
)
|
| 138 |
except Exception as e:
|
| 139 |
raise gr.Error(f"Failed to download test file: {e}")
|