import os | |
import yaml | |
data_folder = "data" | |
data = {"license": "mit", "configs": []} | |
# Collect configurations based on folder structure | |
for folder_name in os.listdir(data_folder): | |
folder_path = os.path.join(data_folder, folder_name) | |
if os.path.isdir(folder_path): | |
config = { | |
"config_name": folder_name, | |
"data_files": f"{folder_path}/{folder_name}_dataset.parquet" | |
} | |
data["configs"].append(config) | |
# Write YAML to README.md with delimiters | |
with open("README.md", "w") as file: | |
file.write("---\n") # Add starting delimiter | |
yaml.dump(data, file, default_flow_style=False) | |
file.write("---\n") # Add ending delimiter |