import pickleimport requests# Define the URL to download the file fromurl ="https://huggingface.co/spaces/lmsys/chatbot-arena-leaderboard/resolve/main/elo_results_20240805.pkl"try:# Download the file response = requests.get(url, allow_redirects=True)# Check if the download was successfulif response.status_code ==200:print("File downloaded successfully.")# Load the file into a Python object using picklewithopen('elo_results_20240805.pkl', 'wb') asfile:file.write(response.content) data = pickle.load(open('elo_results_20240805.pkl', 'rb'))# print(data) # Print the loaded dataelse:print(f"Failed to download the file. Status code: {response.status_code}")exceptExceptionas e:print(f"An error occurred: {e}")
File downloaded successfully.
import pandas as pdleaderboard_table_df = data['text']['full']['leaderboard_table_df']leaderboard_table_df.to_csv('elo_results_20240805.csv', index=True)