Spaces:
Sleeping
Sleeping
import pandas as pd | |
from collections import defaultdict | |
import copy as cp | |
import numpy as np | |
import json | |
import requests | |
## Load CinePile Data from URL | |
RESULTS_URL = "https://raw.githubusercontent.com/JARVVVIS/cinepile_leaderboard/refs/heads/main/assets/cinepile_results.json" | |
cinepile_data = json.loads(requests.get(RESULTS_URL).text) | |
# Function to build the leaderboard DataFrame | |
def BUILD_L1_DF(data): | |
res = defaultdict(list) | |
for item in data: | |
res["Model"].append(item["Model"]) | |
res["Params (B)"].append(item["Params"].split("B")[0]) | |
res["Average Accuracy"].append(item["Avg"]) | |
res["CRD"].append(item["CRD"]) | |
res["NPA"].append(item["NPA"]) | |
res["STA"].append(item["STA"]) | |
res["TEMP"].append(item["TEMP"]) | |
res["TH"].append(item["TH"]) | |
# Build DataFrame and rank by average score | |
df = pd.DataFrame(res) | |
df["Average Rank"] = df["Average Accuracy"].rank(ascending=False) | |
df = df.sort_values(by="Average Rank") | |
check_box = { | |
"essential": [ | |
"Model", | |
"Params (B)", | |
"Average Accuracy", | |
"Average Rank", | |
], | |
"question_categories": ["CRD", "NPA", "STA", "TEMP", "TH"], | |
"required": ["Average Accuracy", "Average Rank"], | |
"all": [ | |
"Model", | |
"Params (B)", | |
"Average Accuracy", | |
"CRD", | |
"NPA", | |
"STA", | |
"TEMP", | |
"TH", | |
"Average Rank", | |
], | |
"type_map": defaultdict( | |
lambda: "number", {"Model": "str", "Params (B)": "str"} | |
), | |
} | |
return df, check_box | |
def load_results(): | |
# Simulate loading CinePile data (replace with actual data loading if necessary) | |
return cinepile_data | |
def format_timestamp(timestamp): | |
return ( | |
timestamp[:2] | |
+ "." | |
+ timestamp[2:4] | |
+ "." | |
+ timestamp[4:6] | |
+ " " | |
+ timestamp[6:8] | |
+ ":" | |
+ timestamp[8:10] | |
+ ":" | |
+ timestamp[10:12] | |
) | |