Spaces:
Runtime error
Runtime error
Update app.py
Browse files
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 |
-
|
167 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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({})
|