from datasets import Dataset, load_dataset | |
DATASET_PATH = "leaderboard_dataset" | |
# εζγγΌγΏ | |
INITIAL_DATA = { | |
"Model Name": ["Baseline Model"], | |
"Score": [0.8], | |
"Rank": [1], | |
} | |
# γγΌγΏγ»γγγεζεγΎγγ―γγΌγ | |
def load_or_initialize_leaderboard(): | |
try: | |
dataset = Dataset.load_from_disk(DATASET_PATH) | |
except FileNotFoundError: | |
dataset = Dataset.from_dict(INITIAL_DATA) | |
dataset.save_to_disk(DATASET_PATH) | |
return dataset | |
# γγΌγΏγ»γγγδΏε | |
def save_leaderboard(dataset): | |
dataset.save_to_disk(DATASET_PATH) | |