File size: 1,518 Bytes
06ee306 |
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 |
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 = [
'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',
'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!") |