python download sklearm model joblib from google stroage

Solutions on MaxInterview for python download sklearm model joblib from google stroage by the best coders in the world

showing results for - "python download sklearm model joblib from google stroage"
Marylou
14 Aug 2019
1from google.cloud import storage
2from sklearn.externals import joblib
3from io import BytesIO
4
5storage_client = storage.Client()
6bucket_name=<bucket name>
7model_bucket='model.joblib'
8
9bucket = storage_client.get_bucket(bucket_name)
10#select bucket file
11blob = bucket.blob(model_bucket)
12#download blob into an in-memory file object
13model_file = BytesIO()
14blob.download_to_file(model_file)
15#load into joblib
16model=joblib.load(model_local)