Open aprknight opened 9 months ago
To download Kaggle datasets into Google Drive:
First, generate an API key in your Kaggle settings. Then, open google collab and run-in
!pip install opendatasets
It will prompt you to enter your Kaggle username and API key. After that, replace the dataset URL with your desired Kaggle dataset URL, and in the new_folder_name parameter, provide the folder name.
import shutil import opendatasets as od import os
from google.colab import drive
drive.mount('/content/drive')
output_dir = '/content/drive/MyDrive/Kaggle_Datasets'
new_folder_name = 'Embryo_Classification'
new_folder_path = os.path.join(output_dir, new_folder_name) os.makedirs(new_folder_path, exist_ok=True)
dataset_url = 'https://www.kaggle.com/datasets/gauravduttakiit/embryo-classification-efficientnet/data'
od.download(dataset_url, data_dir=new_folder_path)
zip_file_name = 'embryo-classification-efficientnet.zip' zip_file_path = os.path.join(output_dir, zip_file_name) shutil.move(zip_file_path, new_folder_path)
In rest.py we have this line:
But what if the data are not encoded as UTF-8 ?