rwitz commited on
Commit
0d45e75
1 Parent(s): 7e98abe

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -2
app.py CHANGED
@@ -162,12 +162,22 @@ def user_ask(state, chatbot1, chatbot2, textbox):
162
  import pandas as pd
163
 
164
  # Function to generate leaderboard data
 
165
  def generate_leaderboard():
166
- elo_ratings = get_user_elo_ratings() # Assuming this function returns a dict of {bot_name: elo_score}
167
- leaderboard_data = pd.DataFrame(list(elo_ratings.iter(batch_size=100)), columns=['Chatbot', 'ELO Score'])
 
 
 
 
 
 
 
168
  leaderboard_data = leaderboard_data.sort_values('ELO Score', ascending=False)
 
169
  return leaderboard_data
170
 
 
171
  # Gradio interface setup
172
  with gr.Blocks() as demo:
173
  state = gr.State({})
 
162
  import pandas as pd
163
 
164
  # Function to generate leaderboard data
165
+
166
  def generate_leaderboard():
167
+ elo_ratings_dataset = get_user_elo_ratings() # Returns a Hugging Face dataset
168
+
169
+ # Convert the Hugging Face dataset to a pandas DataFrame
170
+ leaderboard_data = pd.DataFrame(elo_ratings_dataset)
171
+
172
+ # Assuming the dataset has columns 'bot_name' and 'elo_rating'
173
+ leaderboard_data.columns = ['Chatbot', 'ELO Score']
174
+
175
+ # Sort the DataFrame based on the ELO Score in descending order
176
  leaderboard_data = leaderboard_data.sort_values('ELO Score', ascending=False)
177
+
178
  return leaderboard_data
179
 
180
+
181
  # Gradio interface setup
182
  with gr.Blocks() as demo:
183
  state = gr.State({})