Spaces:
Runtime error
Runtime error
Update app.py
Browse files
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 |
-
|
| 188 |
-
|
| 189 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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/")
|