-
-
Save minesh1291/363caebab5b16f2d281e3c8aa2d9dd26 to your computer and use it in GitHub Desktop.
Send large files from Google Colab to Google Drive.
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
| # Which file to send? | |
| file_name = "REPO.tar" | |
| from googleapiclient.http import MediaFileUpload | |
| from googleapiclient.discovery import build | |
| auth.authenticate_user() | |
| drive_service = build('drive', 'v3') | |
| def save_file_to_drive(name, path): | |
| file_metadata = {'name': name, 'mimeType': 'application/octet-stream'} | |
| media = MediaFileUpload(path, mimetype='application/octet-stream', resumable=True) | |
| created = drive_service.files().create(body=file_metadata, media_body=media, fields='id').execute() | |
| return created | |
| save_file_to_drive(file_name, file_name) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment