Created
January 26, 2024 07:43
-
-
Save sachithrrra/ddd38ae2758c7f4eb928f1622caf1e92 to your computer and use it in GitHub Desktop.
Download dataset from Kaggle to Google Drive on Google Colab
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Credits: https://www.kaggle.com/discussions/general/74235#2193182 | |
# Step 1: | |
# Use below code to upload your kaggle.json to colab environment (you can download kaggle.json from your Profile->Account->API Token) | |
from google.colab import files | |
files.upload() | |
# Step 2: | |
# Below code will remove any existing ~/.kaggle directory and create a new one. It will also move your kaggle.json to ~/.kaggle | |
!rm -r ~/.kaggle | |
!mkdir ~/.kaggle | |
!mv ./kaggle.json ~/.kaggle/ | |
!chmod 600 ~/.kaggle/kaggle.json | |
# Step 3: | |
# Download Dataset. For example I am downloading https://www.kaggle.com/competitions/happy-whale-and-dolphin | |
!kaggle competitions download -c happy-whale-and-dolphin |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment