File size: 2,065 Bytes
f6eed87
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
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]
    )