Created
October 29, 2020 12:51
-
-
Save lusoal/e41b8fcab5ac017433b5218aebca573e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| dataset_car_path_ec2 = "/home/ec2-user/SageMaker/sagemaker-advanced-workshop/labs/01-sagemaker-introduction/datasetcars" | |
| dataset_car_path_s3 = f"{prefix}/datasetcars" | |
| def upload_to_s3_new(channel, file, file_name): | |
| s3 = boto3.resource('s3') | |
| data = open(file, 'rb') | |
| key = f'{channel}/{file_name}' | |
| s3.Bucket(bucket).put_object(Key=key, Body=data) | |
| images = os.listdir(dataset_car_path_ec2) | |
| for image in images: | |
| print(f"Uploading {image} to {bucket}") | |
| upload_to_s3_new(dataset_car_path_s3, f"{dataset_car_path_ec2}/{image}", image) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment