Spaces:
Sleeping
Sleeping
Commit
Β·
1af5fea
1
Parent(s):
e28bc70
fix oauth config
Browse files- README.md +1 -0
- datasets_resource.py +5 -9
- events_resource.py +5 -9
- initiatives_resource.py +5 -9
- models_resource.py +5 -9
- shared_tasks_resource.py +14 -20
README.md
CHANGED
|
@@ -8,4 +8,5 @@ sdk_version: 4.26.0
|
|
| 8 |
app_file: app.py
|
| 9 |
pinned: false
|
| 10 |
license: apache-2.0
|
|
|
|
| 11 |
---
|
|
|
|
| 8 |
app_file: app.py
|
| 9 |
pinned: false
|
| 10 |
license: apache-2.0
|
| 11 |
+
hf_oauth: true
|
| 12 |
---
|
datasets_resource.py
CHANGED
|
@@ -64,11 +64,6 @@ def search_and_filter_data(df: pd.DataFrame, search_query: str) -> pd.DataFrame:
|
|
| 64 |
return filtered_df
|
| 65 |
|
| 66 |
|
| 67 |
-
def check_login(profile: gr.OAuthProfile | None) -> bool:
|
| 68 |
-
"""Check if a user is logged in."""
|
| 69 |
-
return profile is not None
|
| 70 |
-
|
| 71 |
-
|
| 72 |
def validate_url(url: str) -> bool:
|
| 73 |
"""Validate if a string is a valid URL."""
|
| 74 |
if not url:
|
|
@@ -92,8 +87,8 @@ def submit_resource(
|
|
| 92 |
):
|
| 93 |
"""Submit a new resource to the corresponding dataset."""
|
| 94 |
|
| 95 |
-
#
|
| 96 |
-
if
|
| 97 |
return "β Error: You need to be logged in to submit a resource."
|
| 98 |
|
| 99 |
# Validate required fields
|
|
@@ -463,8 +458,9 @@ def update_entry(
|
|
| 463 |
profile: gr.OAuthProfile | None,
|
| 464 |
):
|
| 465 |
"""Update an existing entry."""
|
| 466 |
-
|
| 467 |
-
|
|
|
|
| 468 |
|
| 469 |
username = profile.username
|
| 470 |
if not username:
|
|
|
|
| 64 |
return filtered_df
|
| 65 |
|
| 66 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 67 |
def validate_url(url: str) -> bool:
|
| 68 |
"""Validate if a string is a valid URL."""
|
| 69 |
if not url:
|
|
|
|
| 87 |
):
|
| 88 |
"""Submit a new resource to the corresponding dataset."""
|
| 89 |
|
| 90 |
+
# Login required
|
| 91 |
+
if profile is None:
|
| 92 |
return "β Error: You need to be logged in to submit a resource."
|
| 93 |
|
| 94 |
# Validate required fields
|
|
|
|
| 458 |
profile: gr.OAuthProfile | None,
|
| 459 |
):
|
| 460 |
"""Update an existing entry."""
|
| 461 |
+
# Login required
|
| 462 |
+
if profile is None:
|
| 463 |
+
return "β Error: You need to be logged in to edit entries."
|
| 464 |
|
| 465 |
username = profile.username
|
| 466 |
if not username:
|
events_resource.py
CHANGED
|
@@ -58,11 +58,6 @@ def search_and_filter_data(df: pd.DataFrame, search_query: str) -> pd.DataFrame:
|
|
| 58 |
return filtered_df
|
| 59 |
|
| 60 |
|
| 61 |
-
def check_login(profile: gr.OAuthProfile | None) -> bool:
|
| 62 |
-
"""Check if a user is logged in."""
|
| 63 |
-
return profile is not None
|
| 64 |
-
|
| 65 |
-
|
| 66 |
def validate_url(url: str) -> bool:
|
| 67 |
"""Validate if a string is a valid URL."""
|
| 68 |
if not url:
|
|
@@ -95,8 +90,8 @@ def submit_resource(
|
|
| 95 |
):
|
| 96 |
"""Submit a new resource to the corresponding dataset."""
|
| 97 |
|
| 98 |
-
#
|
| 99 |
-
if
|
| 100 |
return "β Error: You need to be logged in to submit a resource."
|
| 101 |
|
| 102 |
# Validate required fields
|
|
@@ -372,8 +367,9 @@ def update_entry(
|
|
| 372 |
profile: gr.OAuthProfile | None,
|
| 373 |
):
|
| 374 |
"""Update an existing entry."""
|
| 375 |
-
|
| 376 |
-
|
|
|
|
| 377 |
|
| 378 |
username = profile.username
|
| 379 |
if not username:
|
|
|
|
| 58 |
return filtered_df
|
| 59 |
|
| 60 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 61 |
def validate_url(url: str) -> bool:
|
| 62 |
"""Validate if a string is a valid URL."""
|
| 63 |
if not url:
|
|
|
|
| 90 |
):
|
| 91 |
"""Submit a new resource to the corresponding dataset."""
|
| 92 |
|
| 93 |
+
# Login required
|
| 94 |
+
if profile is None:
|
| 95 |
return "β Error: You need to be logged in to submit a resource."
|
| 96 |
|
| 97 |
# Validate required fields
|
|
|
|
| 367 |
profile: gr.OAuthProfile | None,
|
| 368 |
):
|
| 369 |
"""Update an existing entry."""
|
| 370 |
+
# Login required
|
| 371 |
+
if profile is None:
|
| 372 |
+
return "β Error: You need to be logged in to edit entries."
|
| 373 |
|
| 374 |
username = profile.username
|
| 375 |
if not username:
|
initiatives_resource.py
CHANGED
|
@@ -56,11 +56,6 @@ def search_and_filter_data(df: pd.DataFrame, search_query: str) -> pd.DataFrame:
|
|
| 56 |
return filtered_df
|
| 57 |
|
| 58 |
|
| 59 |
-
def check_login(profile: gr.OAuthProfile | None) -> bool:
|
| 60 |
-
"""Check if a user is logged in."""
|
| 61 |
-
return profile is not None
|
| 62 |
-
|
| 63 |
-
|
| 64 |
def validate_url(url: str) -> bool:
|
| 65 |
"""Validate if a string is a valid URL."""
|
| 66 |
if not url:
|
|
@@ -78,8 +73,8 @@ def submit_resource(
|
|
| 78 |
):
|
| 79 |
"""Submit a new resource to the corresponding dataset."""
|
| 80 |
|
| 81 |
-
#
|
| 82 |
-
if
|
| 83 |
return "β Error: You need to be logged in to submit a resource."
|
| 84 |
|
| 85 |
# Validate required fields
|
|
@@ -355,8 +350,9 @@ def update_entry(
|
|
| 355 |
profile: gr.OAuthProfile | None,
|
| 356 |
):
|
| 357 |
"""Update an existing entry."""
|
| 358 |
-
|
| 359 |
-
|
|
|
|
| 360 |
|
| 361 |
username = profile.username
|
| 362 |
if not username:
|
|
|
|
| 56 |
return filtered_df
|
| 57 |
|
| 58 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 59 |
def validate_url(url: str) -> bool:
|
| 60 |
"""Validate if a string is a valid URL."""
|
| 61 |
if not url:
|
|
|
|
| 73 |
):
|
| 74 |
"""Submit a new resource to the corresponding dataset."""
|
| 75 |
|
| 76 |
+
# Login required
|
| 77 |
+
if profile is None:
|
| 78 |
return "β Error: You need to be logged in to submit a resource."
|
| 79 |
|
| 80 |
# Validate required fields
|
|
|
|
| 350 |
profile: gr.OAuthProfile | None,
|
| 351 |
):
|
| 352 |
"""Update an existing entry."""
|
| 353 |
+
# Login required
|
| 354 |
+
if profile is None:
|
| 355 |
+
return "β Error: You need to be logged in to edit entries."
|
| 356 |
|
| 357 |
username = profile.username
|
| 358 |
if not username:
|
models_resource.py
CHANGED
|
@@ -50,11 +50,6 @@ def search_and_filter_data(df: pd.DataFrame, search_query: str) -> pd.DataFrame:
|
|
| 50 |
return filtered_df
|
| 51 |
|
| 52 |
|
| 53 |
-
def check_login(profile: gr.OAuthProfile | None) -> bool:
|
| 54 |
-
"""Check if a user is logged in."""
|
| 55 |
-
return profile is not None
|
| 56 |
-
|
| 57 |
-
|
| 58 |
def validate_url(url: str) -> bool:
|
| 59 |
"""Validate if a string is a valid URL."""
|
| 60 |
if not url:
|
|
@@ -86,8 +81,8 @@ def submit_resource(
|
|
| 86 |
):
|
| 87 |
"""Submit a new resource to the corresponding dataset."""
|
| 88 |
|
| 89 |
-
#
|
| 90 |
-
if
|
| 91 |
return "β Error: You need to be logged in to submit a resource."
|
| 92 |
|
| 93 |
# Validate required fields
|
|
@@ -326,8 +321,9 @@ def update_entry(
|
|
| 326 |
profile: gr.OAuthProfile | None,
|
| 327 |
):
|
| 328 |
"""Update an existing entry."""
|
| 329 |
-
|
| 330 |
-
|
|
|
|
| 331 |
|
| 332 |
username = profile.username
|
| 333 |
if not username:
|
|
|
|
| 50 |
return filtered_df
|
| 51 |
|
| 52 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 53 |
def validate_url(url: str) -> bool:
|
| 54 |
"""Validate if a string is a valid URL."""
|
| 55 |
if not url:
|
|
|
|
| 81 |
):
|
| 82 |
"""Submit a new resource to the corresponding dataset."""
|
| 83 |
|
| 84 |
+
# Login required
|
| 85 |
+
if profile is None:
|
| 86 |
return "β Error: You need to be logged in to submit a resource."
|
| 87 |
|
| 88 |
# Validate required fields
|
|
|
|
| 321 |
profile: gr.OAuthProfile | None,
|
| 322 |
):
|
| 323 |
"""Update an existing entry."""
|
| 324 |
+
# Login required
|
| 325 |
+
if profile is None:
|
| 326 |
+
return "β Error: You need to be logged in to edit entries."
|
| 327 |
|
| 328 |
username = profile.username
|
| 329 |
if not username:
|
shared_tasks_resource.py
CHANGED
|
@@ -66,11 +66,6 @@ def search_and_filter_data(df: pd.DataFrame, search_query: str) -> pd.DataFrame:
|
|
| 66 |
return filtered_df
|
| 67 |
|
| 68 |
|
| 69 |
-
def check_login(profile: gr.OAuthProfile | None) -> bool:
|
| 70 |
-
"""Check if a user is logged in."""
|
| 71 |
-
return profile is not None
|
| 72 |
-
|
| 73 |
-
|
| 74 |
def validate_url(url: str) -> bool:
|
| 75 |
"""Validate if a string is a valid URL."""
|
| 76 |
if not url:
|
|
@@ -109,8 +104,8 @@ def submit_resource(
|
|
| 109 |
):
|
| 110 |
"""Submit a new resource to the corresponding dataset."""
|
| 111 |
|
| 112 |
-
#
|
| 113 |
-
if
|
| 114 |
return "β Error: You need to be logged in to submit a resource."
|
| 115 |
|
| 116 |
# Validate required fields
|
|
@@ -146,16 +141,16 @@ def submit_resource(
|
|
| 146 |
return f"β Error: {field_name} is required for future tasks."
|
| 147 |
|
| 148 |
# Validate date formats for future tasks
|
| 149 |
-
|
| 150 |
-
|
| 151 |
-
|
| 152 |
-
|
| 153 |
-
|
| 154 |
-
|
| 155 |
|
| 156 |
-
|
| 157 |
-
|
| 158 |
-
|
| 159 |
else:
|
| 160 |
# For past tasks, paper_link is required
|
| 161 |
if not paper_link:
|
|
@@ -626,12 +621,11 @@ def update_entry(
|
|
| 626 |
profile: gr.OAuthProfile | None,
|
| 627 |
):
|
| 628 |
"""Update an existing entry."""
|
| 629 |
-
|
| 630 |
-
|
|
|
|
| 631 |
|
| 632 |
username = profile.username
|
| 633 |
-
if not username:
|
| 634 |
-
return "β Could not get username from profile."
|
| 635 |
|
| 636 |
if not original_name:
|
| 637 |
return "β No entry selected to edit."
|
|
|
|
| 66 |
return filtered_df
|
| 67 |
|
| 68 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 69 |
def validate_url(url: str) -> bool:
|
| 70 |
"""Validate if a string is a valid URL."""
|
| 71 |
if not url:
|
|
|
|
| 104 |
):
|
| 105 |
"""Submit a new resource to the corresponding dataset."""
|
| 106 |
|
| 107 |
+
# Login required
|
| 108 |
+
if profile is None:
|
| 109 |
return "β Error: You need to be logged in to submit a resource."
|
| 110 |
|
| 111 |
# Validate required fields
|
|
|
|
| 141 |
return f"β Error: {field_name} is required for future tasks."
|
| 142 |
|
| 143 |
# Validate date formats for future tasks
|
| 144 |
+
dates_to_check = [
|
| 145 |
+
("Registration Deadline", registration_deadline),
|
| 146 |
+
("Workshop Date", workshop_date),
|
| 147 |
+
("Data Available Date", data_available_date),
|
| 148 |
+
("Submission Deadline", submission_deadline),
|
| 149 |
+
]
|
| 150 |
|
| 151 |
+
for date_name, date_value in dates_to_check:
|
| 152 |
+
if not validate_date(date_value):
|
| 153 |
+
return f"β Error: {date_name} must be in DD/MM/YYYY format."
|
| 154 |
else:
|
| 155 |
# For past tasks, paper_link is required
|
| 156 |
if not paper_link:
|
|
|
|
| 621 |
profile: gr.OAuthProfile | None,
|
| 622 |
):
|
| 623 |
"""Update an existing entry."""
|
| 624 |
+
# Login required
|
| 625 |
+
if profile is None:
|
| 626 |
+
return "β Error: You need to be logged in to edit entries."
|
| 627 |
|
| 628 |
username = profile.username
|
|
|
|
|
|
|
| 629 |
|
| 630 |
if not original_name:
|
| 631 |
return "β No entry selected to edit."
|