vibs08 commited on
Commit
30eb95f
1 Parent(s): b27372f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -4
app.py CHANGED
@@ -183,10 +183,16 @@ def show_mask_img(input_image: Image) -> Image:
183
 
184
 
185
  def upload_file_to_s3(file_path, bucket_name, object_name=None):
186
-
187
- s3_client.upload_file(file_path, bucket_name, object_name)
188
-
189
- return True
 
 
 
 
 
 
190
 
191
 
192
  @app.post("/process-image/")
 
183
 
184
 
185
  def upload_file_to_s3(file_path, bucket_name, object_name=None):
186
+ try:
187
+ s3_client.upload_file(file_path, bucket_name, object_name)
188
+ return True
189
+ except NoCredentialsError:
190
+ print("Credentials not available")
191
+ except PartialCredentialsError:
192
+ print("Incomplete credentials provided")
193
+ except boto3.exceptions.S3UploadFailedError as e:
194
+ print(f"Upload failed: {e}")
195
+ return False
196
 
197
 
198
  @app.post("/process-image/")