Вы находитесь на странице: 1из 1

!

pip install -U -q PyDrive # to import data directly from google drive

from pydrive.auth import GoogleAuth


from pydrive.drive import GoogleDrive #to acess googledrive
from google.colab import auth # to ascess colab
from oauth2client.client import GoogleCredentials

#authenticate the user


auth.authenticate_user()
gauth= GoogleAuth()
gauth.credentials=GoogleCredentials.get_application_default()
drive= GoogleDrive(gauth) #On running, you have to sign
in and give the token id.

!mkdir -p drive
os.chdir('/content/drive/')

#to upload from your system


from google.colab import files
from io import BytesIO
uploaded = files.upload() #here the necessary files are uploaded into the created
cloud folder 'drive'

OR
#to upload from drive
td= drive.CreateFile({'id':'18HdyqjJv9FuUxWClpTq9mPIknMbtdOcj'}) #second attribute
is shrable link id of file in drive
td.GetContentFile('video_2018-07-27_09-28-54.mp4') #file name

!pwd
!ls #the uploaded mp4 file and txt file will be listd

# Then import necessary packages and execute your code.

#NB: Free GPU can be acessed for 12 hrs only.

Вам также может понравиться