Spaces:
Sleeping
Sleeping
import os | |
import json | |
import shutil | |
data_path = './data/' | |
no_generated_image_path = './no_generated_image.png' # Update this path to the location of no_generated_image.png | |
expected_files = [ | |
'bigcode_leaderboard.json', | |
'bigcode_leaderboard.png', | |
'hf_llm_diagramv2.json', | |
'hf_llm_diagramv2.png', | |
'hf_llm_diagramv2_other_permissive.json', | |
'hf_llm_diagramv2_other_permissive.png', | |
'hf_llm_diagramv2_permissive.json', | |
'hf_llm_diagramv2_permissive.png', | |
'hf_llm_diagramv2_rescore.json', | |
'hf_llm_diagramv2_rescore.png', | |
'hf_llm_diagramv2_rescore2.json', | |
'hf_llm_diagramv2_rescore2.png', | |
'hg_average_to_agentbench_compare.png', | |
'hg_average_to_alpacaeval_compare.png', | |
'hg_average_to_mosaic_compare.png', | |
'hg_average_to_mt_bench_compare.png', | |
'hg_average_to_opencompass_compare.png' | |
] | |
# Traverse the directories under /data/ that match the date format | |
for dir_name in os.listdir(data_path): | |
if os.path.isdir(os.path.join(data_path, dir_name)): | |
for expected_file in expected_files: | |
file_path = os.path.join(data_path, dir_name, expected_file) | |
# Check if the file is missing | |
if not os.path.exists(file_path): | |
# If it's a PNG file, copy the no_generated_image.png | |
if expected_file.endswith('.png'): | |
shutil.copy(no_generated_image_path, file_path) | |
# If it's a JSON file, create it with [] as its content | |
elif expected_file.endswith('.json'): | |
with open(file_path, 'w') as f: | |
json.dump([], f) | |
print("Process completed!") |