Hidden features of Google Colaboratory

Source

Upload files directly from Colab

from google.colab import files
files.upload()

Download trained models

from google.colab import files
files.download("File Name")
model.save('trained_model.h5') #where model is already trained
from google.colab import files
files.download("trained_model.h5")
from urllib.request import urlretrieve
import os
from zipfile import ZipFile

def download(url, file):
if not os.path.isfile(file):
print("Download file... " + file + " ...")
urlretrieve(url,file)
print("File downloaded")

download('Url of the file','Name of the file to be saved')
print("All the files are downloaded")
#If the downloaded file is a zip file than you can use below function to unzip it.
def
uncompress_features_labels(dir):
if(os.path.isdir('data')):
print('Data extracted')
else:
with ZipFile(dir) as zipf:
zipf.extractall('data')
uncompress_features_labels('data.zip')

Executing command

!pip install — upgrade tensorflow

--

--

Autonomous Vehicle Engineer. #FutureAI #LearningAI

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store