vote-system-bugfix

#878
by alozowski HF staff - opened
Files changed (1) hide show
  1. src/voting/vote_system.py +6 -2
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 not "model_name" in pending_models_df.columns:
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):