Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
alozowski
commited on
Commit
•
f02f25c
1
Parent(s):
49a5f27
Fix vote system bug [WIP]
Browse files- src/submission/submit.py +13 -12
- src/voting/vote_system.py +6 -2
src/submission/submit.py
CHANGED
@@ -68,12 +68,13 @@ def add_new_eval(
|
|
68 |
use_chat_template: bool,
|
69 |
profile: gr.OAuthProfile | None
|
70 |
):
|
71 |
-
# Login required
|
72 |
-
if profile is None:
|
73 |
-
|
74 |
|
75 |
-
# Name of the actual user who sent the request
|
76 |
-
username = profile.username
|
|
|
77 |
|
78 |
global REQUESTED_MODELS
|
79 |
global USERS_TO_SUBMISSION_DATES
|
@@ -187,13 +188,13 @@ def add_new_eval(
|
|
187 |
|
188 |
print("Uploading eval file")
|
189 |
print(eval_entry)
|
190 |
-
API.upload_file(
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
)
|
197 |
|
198 |
# Remove the local file
|
199 |
os.remove(out_path)
|
|
|
68 |
use_chat_template: bool,
|
69 |
profile: gr.OAuthProfile | None
|
70 |
):
|
71 |
+
# # Login required
|
72 |
+
# if profile is None:
|
73 |
+
# return styled_error("Hub Login Required")
|
74 |
|
75 |
+
# # Name of the actual user who sent the request
|
76 |
+
# username = profile.username
|
77 |
+
username = "test"
|
78 |
|
79 |
global REQUESTED_MODELS
|
80 |
global USERS_TO_SUBMISSION_DATES
|
|
|
188 |
|
189 |
print("Uploading eval file")
|
190 |
print(eval_entry)
|
191 |
+
# API.upload_file(
|
192 |
+
# path_or_fileobj=out_path,
|
193 |
+
# path_in_repo=out_path.split("eval-queue/")[1],
|
194 |
+
# repo_id=QUEUE_REPO,
|
195 |
+
# repo_type="dataset",
|
196 |
+
# commit_message=f"Add {model} to eval queue",
|
197 |
+
# )
|
198 |
|
199 |
# Remove the local file
|
200 |
os.remove(out_path)
|
src/voting/vote_system.py
CHANGED
@@ -56,8 +56,9 @@ class VoteManager:
|
|
56 |
return "main"
|
57 |
|
58 |
def create_request_vote_df(self, pending_models_df: gr.Dataframe):
|
59 |
-
if pending_models_df.empty or
|
60 |
return pending_models_df
|
|
|
61 |
self.vote_dataset = self.read_vote_dataset()
|
62 |
vote_counts = self.vote_dataset.groupby(['model', 'revision']).size().reset_index(name='vote_count')
|
63 |
|
@@ -79,7 +80,7 @@ class VoteManager:
|
|
79 |
def add_vote(
|
80 |
self,
|
81 |
selected_model: str,
|
82 |
-
pending_models_df: gr.Dataframe,
|
83 |
profile: gr.OAuthProfile | None
|
84 |
):
|
85 |
logger.debug(f"Type of list before usage: {type(list)}")
|
@@ -126,6 +127,9 @@ class VoteManager:
|
|
126 |
self.vote_check_set.add(check_tuple)
|
127 |
gr.Info(f"Voted for {selected_model}")
|
128 |
|
|
|
|
|
|
|
129 |
return self.create_request_vote_df(pending_models_df)
|
130 |
|
131 |
def upload_votes(self):
|
|
|
56 |
return "main"
|
57 |
|
58 |
def create_request_vote_df(self, pending_models_df: gr.Dataframe):
|
59 |
+
if pending_models_df.empty or "model_name" not in pending_models_df.columns:
|
60 |
return pending_models_df
|
61 |
+
|
62 |
self.vote_dataset = self.read_vote_dataset()
|
63 |
vote_counts = self.vote_dataset.groupby(['model', 'revision']).size().reset_index(name='vote_count')
|
64 |
|
|
|
80 |
def add_vote(
|
81 |
self,
|
82 |
selected_model: str,
|
83 |
+
pending_models_df: gr.Dataframe | None,
|
84 |
profile: gr.OAuthProfile | None
|
85 |
):
|
86 |
logger.debug(f"Type of list before usage: {type(list)}")
|
|
|
127 |
self.vote_check_set.add(check_tuple)
|
128 |
gr.Info(f"Voted for {selected_model}")
|
129 |
|
130 |
+
if pending_models_df is None:
|
131 |
+
return
|
132 |
+
|
133 |
return self.create_request_vote_df(pending_models_df)
|
134 |
|
135 |
def upload_votes(self):
|