Delete json_leaderboard.py
Browse files- json_leaderboard.py +0 -121
json_leaderboard.py
DELETED
|
@@ -1,121 +0,0 @@
|
|
| 1 |
-
import json
|
| 2 |
-
import pandas as pd
|
| 3 |
-
from pathlib import Path
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
def load_leaderboard_from_json(json_path="leaderboard_data.json"):
|
| 7 |
-
"""Load leaderboard data from JSON file"""
|
| 8 |
-
try:
|
| 9 |
-
with open(json_path, 'r', encoding='utf-8') as f:
|
| 10 |
-
data = json.load(f)
|
| 11 |
-
return data['leaderboard']
|
| 12 |
-
except FileNotFoundError:
|
| 13 |
-
print(f"JSON file {json_path} not found")
|
| 14 |
-
return []
|
| 15 |
-
except json.JSONDecodeError:
|
| 16 |
-
print(f"Error decoding JSON file {json_path}")
|
| 17 |
-
return []
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
def create_leaderboard_df(json_path="leaderboard_data.json"):
|
| 21 |
-
"""Create a pandas DataFrame from JSON leaderboard data"""
|
| 22 |
-
leaderboard_data = load_leaderboard_from_json(json_path)
|
| 23 |
-
|
| 24 |
-
if not leaderboard_data:
|
| 25 |
-
return pd.DataFrame()
|
| 26 |
-
|
| 27 |
-
# Convert to DataFrame
|
| 28 |
-
df = pd.DataFrame(leaderboard_data)
|
| 29 |
-
|
| 30 |
-
# Sort by ACC score (descending)
|
| 31 |
-
df = df.sort_values('Overall', ascending=False).reset_index(drop=True)
|
| 32 |
-
|
| 33 |
-
# Add ranking icons and make model names clickable links to papers
|
| 34 |
-
def add_ranking_icon_and_link(index, model_name, paper_link):
|
| 35 |
-
if index == 0:
|
| 36 |
-
return f'🥇 <a href="{paper_link}" target="_blank">{model_name}</a>'
|
| 37 |
-
elif index == 1:
|
| 38 |
-
return f'🥈 <a href="{paper_link}" target="_blank">{model_name}</a>'
|
| 39 |
-
elif index == 2:
|
| 40 |
-
return f'🥉 <a href="{paper_link}" target="_blank">{model_name}</a>'
|
| 41 |
-
else:
|
| 42 |
-
return f'<a href="{paper_link}" target="_blank">{model_name}</a>'
|
| 43 |
-
|
| 44 |
-
# Format the DataFrame for display
|
| 45 |
-
display_df = pd.DataFrame({
|
| 46 |
-
'Model': [add_ranking_icon_and_link(i, model, link) for i, (model, link) in enumerate(zip(df['model'], df['link']))],
|
| 47 |
-
'Release Date': df['release_date'],
|
| 48 |
-
'HF Model': df['hf'].apply(lambda x: f'<a href="{x}" target="_blank">🤗</a>' if x != "-" else "-"),
|
| 49 |
-
'Open Source': df['open_source'].apply(lambda x: '✓' if x else '✗'),
|
| 50 |
-
|
| 51 |
-
'Overall': df['Overall'].apply(lambda x: f"{x:.2f}"),
|
| 52 |
-
|
| 53 |
-
'Style': df['Style'].apply(lambda x: f"{x:.2f}"),
|
| 54 |
-
|
| 55 |
-
'World Knowledge': df['World Knowledge'].apply(lambda x: f"{x:.2f}"),
|
| 56 |
-
'Logical Reasoning': df['Logical Reasoning'].apply(lambda x: f"{x:.2f}"),
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
'Text': df['Text'].apply(lambda x: f"{x:.2f}"),
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
'Attribute-Overall': df['Attribute-Overall'].apply(lambda x: f"{x:.2f}"),
|
| 64 |
-
'Quantity': df['Quantity'].apply(lambda x: f"{x:.2f}"),
|
| 65 |
-
'Expression': df['Expression'].apply(lambda x: f"{x:.2f}"),
|
| 66 |
-
'Material': df['Material'].apply(lambda x: f"{x:.2f}"),
|
| 67 |
-
'Size': df['Size'].apply(lambda x: f"{x:.2f}"),
|
| 68 |
-
'Shape': df['Shape'].apply(lambda x: f"{x:.2f}"),
|
| 69 |
-
'Color': df['Color'].apply(lambda x: f"{x:.2f}"),
|
| 70 |
-
|
| 71 |
-
'Action-Overall': df['Action-Overall'].apply(lambda x: f"{x:.2f}"),
|
| 72 |
-
'Hand': df['Hand'].apply(lambda x: f"{x:.2f}"),
|
| 73 |
-
'Full body': df['Full body'].apply(lambda x: f"{x:.2f}"),
|
| 74 |
-
'Animal': df['Animal'].apply(lambda x: f"{x:.2f}"),
|
| 75 |
-
'Non Contact': df['Non Contact'].apply(lambda x: f"{x:.2f}"),
|
| 76 |
-
'Contact': df['Contact'].apply(lambda x: f"{x:.2f}"),
|
| 77 |
-
'State': df['State'].apply(lambda x: f"{x:.2f}"),
|
| 78 |
-
|
| 79 |
-
'Relationship-Overall': df['Relationship-Overall'].apply(lambda x: f"{x:.2f}"),
|
| 80 |
-
'Composition': df['Composition'].apply(lambda x: f"{x:.2f}"),
|
| 81 |
-
'Similarity': df['Similarity'].apply(lambda x: f"{x:.2f}"),
|
| 82 |
-
'Inclusion': df['Inclusion'].apply(lambda x: f"{x:.2f}"),
|
| 83 |
-
'Comparison': df['Comparison'].apply(lambda x: f"{x:.2f}"),
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
'Compound-Overall': df['Compound-Overall'].apply(lambda x: f"{x:.2f}"),
|
| 87 |
-
'Imagination': df['Imagination'].apply(lambda x: f"{x:.2f}"),
|
| 88 |
-
'Feature matching': df['Feature matching'].apply(lambda x: f"{x:.2f}"),
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
'Grammar-Overall': df['Grammar-Overall'].apply(lambda x: f"{x:.2f}"),
|
| 92 |
-
'Pronoun Reference': df['Pronoun Reference'].apply(lambda x: f"{x:.2f}"),
|
| 93 |
-
'Consistency': df['Consistency'].apply(lambda x: f"{x:.2f}"),
|
| 94 |
-
'Negation': df['Negation'].apply(lambda x: f"{x:.2f}"),
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
'Layout-Overall': df['Layout-Overall'].apply(lambda x: f"{x:.2f}"),
|
| 98 |
-
'2D': df['2D'].apply(lambda x: f"{x:.2f}"),
|
| 99 |
-
'3D': df['3D'].apply(lambda x: f"{x:.2f}"),
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
})
|
| 103 |
-
|
| 104 |
-
return display_df
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
def get_leaderboard_stats(json_path="leaderboard_data.json"):
|
| 108 |
-
"""Get statistics about the leaderboard"""
|
| 109 |
-
leaderboard_data = load_leaderboard_from_json(json_path)
|
| 110 |
-
|
| 111 |
-
if not leaderboard_data:
|
| 112 |
-
return {}
|
| 113 |
-
|
| 114 |
-
df = pd.DataFrame(leaderboard_data)
|
| 115 |
-
|
| 116 |
-
stats = {
|
| 117 |
-
'total_models': len(df),
|
| 118 |
-
'open_source_models': df['open_source'].sum(),
|
| 119 |
-
}
|
| 120 |
-
|
| 121 |
-
return stats
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|