Getting started with Google Colaboratory - Part 2

One of the great things about Google Colabs is the simple way that files can be uploaded and downloaded to your Google Drive.

Running a Python script that is on Google Drive

Lets assume that we have a simple TensorFlow script in a folder called code on our Google Drive and that we want to run it in Colab. (..you can download the actual script from my GitHub page).



  • Open a new colab notebook and then run the following code in the code cell..



  • You should see this – click directly on the URL or copy and paste it to your browser..



  • A webpage will open and you will need to log in to your Google Drive account - Allow Google Drive File Stream access to your Google account...



  • Copy the authorisation code then paste it into the cell in the Colab notebook and hit return..



  • It should now look like this:



  • Now to run our script in the code folder in Colab, all you need to do is open a new code cell, then execute a command like this:



  • ..and the training will complete in a few seconds!



Note that if you try to change Runtime type at this point, you will probably have to go through the mount and authorization process again.