File size: 1,007 Bytes
38b0858 |
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 |
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')
|