DRR-RATE / download_metadata_label.py
farrell236's picture
conform to licence agreement
38b0858
raw
history blame
1.01 kB
import shutil
from huggingface_hub import hf_hub_download
hf_token = 'HUGGINGFACE_API_KEY'
repo_id = 'ibrahimhamamci/CT-RATE'
directories = {
'metadata': ['Metadata_Attributes.xlsx', 'train_metadata.csv', 'validation_metadata.csv'],
'multi_abnormality_labels': ['train_predicted_labels.csv', 'valid_predicted_labels.csv'],
'radiology_text_reports': ['train_reports.csv', 'validation_reports.csv']
}
# Download files from each directory
for directory, files_to_download in directories.items():
for file_name in files_to_download:
file_path = f"{directory}/{file_name}"
hf_hub_download(
repo_id=repo_id,
repo_type='dataset',
token=hf_token,
subfolder='dataset',
filename=file_path,
cache_dir='./',
local_dir='./',
local_dir_use_symlinks=False)
shutil.move(f'dataset/{directory}', directory)
shutil.rmtree('./dataset')
shutil.rmtree('./datasets--ibrahimhamamci--CT-RATE')