I would like to store image files on a drive and link to them from a collaboration notebook. Is this possible? For example.
google-drive/
notebook.ipynb
A possible alternative to the great answer by Arpit Gupta for images are publicly shared: Get the ID of your file and prepend this line:
https://docs.google.com/uc?export=download&id=
Grabbed it from this forum post.
Use the following code:
!apt-get install -y -qq software-properties-common python-software-properties module-init-tools
!add-apt-repository -y ppa:alessandro-strada/ppa 2>&1 > /dev/null
!apt-get update -qq 2>&1 > /dev/null
!apt-get -y install -qq google-drive-ocamlfuse fuse
from google.colab import auth
auth.authenticate_user()
from oauth2client.client import GoogleCredentials
creds = GoogleCredentials.get_application_default()
import getpass
!google-drive-ocamlfuse -headless -id={creds.client_id} -secret={creds.client_secret} < /dev/null 2>&1 | grep URL
vcode = getpass.getpass()
!echo {vcode} | google-drive-ocamlfuse -headless -id={creds.client_id} -secret={creds.client_secret}
After running above command it will ask for the key. Click on the provided link and verify it.
Create a folder in drive using:
!mkdir -p colabData
!google-drive-ocamlfuse colabData
After this you can use the drive as if its connected locally:
%%bash
echo "Hello World...!!!" > colabData/hello.txt
ls colabData
Google always loses me in the details. That's where the devil is. Based on the previous answer, these are my steps to make an image sharable so it can be used in a notebook.