If you are using google colab for your work, you can follow the steps below to use dataset:
- Go to your kaggle profile.
- Go to "Account" tab in your profile.
- In the "API" section click on "Create New Token". It download "kaggle.json" file.
- Use the following code for using the dataset. You can paste it in a blank cell:
!pip install -q kaggle
from google.colab import files
files.upload()
!mkdir ~/.kaggle
!cp kaggle.json ~/.kaggle/
!chmod 600 ~/.kaggle/kaggle.json
!kaggle datasets download {link_of_dataset}
!unzip {name_of_dataset}.zip -d {desired_directory}
When you run this cell, it asks you to upload a file. You need to upload the kaggle.json file that you downloaded in step 3.
For example if you want to download the "ASL Alphabet" dataset, use the following code:
!pip install -q kaggle
from google.colab import files
files.upload()
!mkdir ~/.kaggle
!cp kaggle.json ~/.kaggle/
!chmod 600 ~/.kaggle/kaggle.json
!kaggle datasets download 'grassknoted/asl-alphabet'
!unzip asl-alphabet.zip -d /content/