taxfree_python
Rebuild the project
7d9cce6
raw
history blame
593 Bytes
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)