updates
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
# This file contains google utils: https://cloud.google.com/storage/docs/reference/libraries
|
||||
# pip install --upgrade google-cloud-storage
|
||||
|
||||
from google.cloud import storage
|
||||
|
||||
|
||||
def upload_blob(bucket_name, source_file_name, destination_blob_name):
|
||||
# Uploads a file to a bucket
|
||||
# https://cloud.google.com/storage/docs/uploading-objects#storage-upload-object-python
|
||||
|
||||
storage_client = storage.Client()
|
||||
bucket = storage_client.get_bucket(bucket_name)
|
||||
blob = bucket.blob(destination_blob_name)
|
||||
|
||||
blob.upload_from_filename(source_file_name)
|
||||
|
||||
print('File {} uploaded to {}.'.format(
|
||||
source_file_name,
|
||||
destination_blob_name))
|
||||
|
||||
|
||||
def download_blob(bucket_name, source_blob_name, destination_file_name):
|
||||
# Uploads a blob from a bucket
|
||||
storage_client = storage.Client()
|
||||
bucket = storage_client.get_bucket(bucket_name)
|
||||
blob = bucket.blob(source_blob_name)
|
||||
|
||||
blob.download_to_filename(destination_file_name)
|
||||
|
||||
print('Blob {} downloaded to {}.'.format(
|
||||
source_blob_name,
|
||||
destination_file_name))
|
||||
@@ -11,6 +11,7 @@ from PIL import Image
|
||||
from tqdm import tqdm
|
||||
|
||||
from . import torch_utils
|
||||
from . import google_utils
|
||||
|
||||
matplotlib.rc('font', **{'size': 11})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user