= "name"
username = "12345"
key =False) save_kaggle_creds(username, key, overwrite
Credentials already present. Set `overwrite=True` to replace them.
save_kaggle_creds (username:str, key:str, overwrite=False)
Save the Kaggle API credentials.
Type | Default | Details | |
---|---|---|---|
username | str | The Kaggle API username. | |
key | str | The Kaggle API key. | |
overwrite | bool | False | Overwrite existing credentials. |
Credentials already present. Set `overwrite=True` to replace them.
dl_kaggle (kaggle_dataset, archive_path, dataset_path, delete_archive=True)
Download the Kaggle dataset and extract it to the specified directory.
Type | Default | Details | |
---|---|---|---|
kaggle_dataset | The Kaggle dataset id in the format '<username>/<dataset_name>' . |
||
archive_path | The path to save the archive file. | ||
dataset_path | The path to save the extracted dataset. | ||
delete_archive | bool | True | Delete the archive after extraction. |
# Get the path to the directory where datasets are stored
dataset_dir = Path("./Datasets/")
dataset_dir.mkdir(parents=True, exist_ok=True)
print(f"Dataset Directory: {dataset_dir}")
# Create the path to the data directory
archive_dir = dataset_dir/'../Archive'
archive_dir.mkdir(parents=True, exist_ok=True)
print(f"Archive Directory: {archive_dir}")
Dataset Directory: Datasets
Archive Directory: Datasets/../Archive
# Create the path to the zip file that contains the dataset
archive_path = Path(f'{archive_dir}/{dataset_name}.zip')
print(f"Archive Path: {archive_path}")
# Create the path to the directory where the dataset will be extracted
dataset_path = Path(f'{dataset_dir}/{dataset_name}')
print(f"Dataset Path: {dataset_path}")
Archive Path: Datasets/../Archive/style-image-samples.zip
Dataset Path: Datasets/style-image-samples
Downloading style-image-samples.zip to Datasets/../Archive
100%|██████████████████████████████████████████████████████████████████████████████████████████████| 16.2M/16.2M [00:00<00:00, 50.8MB/s]