Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
alozowski
commited on
Commit
·
aa2a210
1
Parent(s):
d42f637
Update vote logic upvote submitted
Browse files- src/display/utils.py +0 -10
- src/submission/submit.py +8 -12
src/display/utils.py
CHANGED
|
@@ -9,16 +9,6 @@ import pandas as pd
|
|
| 9 |
# Configure logging
|
| 10 |
logging.basicConfig(level=logging.INFO, format="%(asctime)s - %(levelname)s - %(message)s")
|
| 11 |
|
| 12 |
-
|
| 13 |
-
def is_user_in_org(username: str, org: str) -> bool:
|
| 14 |
-
url = f"https://huggingface.co/api/users/{username}/overview"
|
| 15 |
-
response = requests.get(url)
|
| 16 |
-
if response.status_code == 200:
|
| 17 |
-
user_info = response.json()
|
| 18 |
-
return any(org_info['name'] == org for org_info in user_info.get('orgs', []))
|
| 19 |
-
else:
|
| 20 |
-
print(f"Failed to fetch user info for {username}. Status code: {response.status_code}")
|
| 21 |
-
return False
|
| 22 |
|
| 23 |
# Convert ISO 8601 dates to datetime objects for comparison
|
| 24 |
def parse_iso8601_datetime(date_str):
|
|
|
|
| 9 |
# Configure logging
|
| 10 |
logging.basicConfig(level=logging.INFO, format="%(asctime)s - %(levelname)s - %(message)s")
|
| 11 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
|
| 13 |
# Convert ISO 8601 dates to datetime objects for comparison
|
| 14 |
def parse_iso8601_datetime(date_str):
|
src/submission/submit.py
CHANGED
|
@@ -27,7 +27,6 @@ from src.submission.check_validity import (
|
|
| 27 |
)
|
| 28 |
|
| 29 |
from src.voting.vote_system import VoteManager
|
| 30 |
-
from src.display.utils import is_user_in_org
|
| 31 |
|
| 32 |
REQUESTED_MODELS = None
|
| 33 |
USERS_TO_SUBMISSION_DATES = None
|
|
@@ -199,20 +198,17 @@ def add_new_eval(
|
|
| 199 |
# Remove the local file
|
| 200 |
os.remove(out_path)
|
| 201 |
|
| 202 |
-
|
| 203 |
-
|
| 204 |
-
|
| 205 |
-
|
| 206 |
-
|
| 207 |
-
|
| 208 |
-
|
| 209 |
-
profile=profile
|
| 210 |
-
)
|
| 211 |
-
print(f"Automatically added a vote for {model} submitted by {username}")
|
| 212 |
|
| 213 |
# Upload votes to the repository
|
| 214 |
vote_manager.upload_votes()
|
| 215 |
|
| 216 |
return styled_message(
|
| 217 |
-
"Your request has been submitted to the evaluation queue!\nPlease wait for up to an hour for the model to show in the PENDING list."
|
| 218 |
)
|
|
|
|
| 27 |
)
|
| 28 |
|
| 29 |
from src.voting.vote_system import VoteManager
|
|
|
|
| 30 |
|
| 31 |
REQUESTED_MODELS = None
|
| 32 |
USERS_TO_SUBMISSION_DATES = None
|
|
|
|
| 198 |
# Remove the local file
|
| 199 |
os.remove(out_path)
|
| 200 |
|
| 201 |
+
# Always add a vote for the submitted model
|
| 202 |
+
vote_manager.add_vote(
|
| 203 |
+
selected_model=model,
|
| 204 |
+
pending_models_df=None,
|
| 205 |
+
profile=profile
|
| 206 |
+
)
|
| 207 |
+
print(f"Automatically added a vote for {model} submitted by {username}")
|
|
|
|
|
|
|
|
|
|
| 208 |
|
| 209 |
# Upload votes to the repository
|
| 210 |
vote_manager.upload_votes()
|
| 211 |
|
| 212 |
return styled_message(
|
| 213 |
+
"Your request and vote has been submitted to the evaluation queue!\nPlease wait for up to an hour for the model to show in the PENDING list."
|
| 214 |
)
|