Commit
·
e85b74e
1
Parent(s):
5d649ba
Updated output file creation variables for Lambda direct redaction runs
Browse files- entrypoint_router.py +0 -22
- lambda_entrypoint.py +5 -1
entrypoint_router.py
DELETED
|
@@ -1,22 +0,0 @@
|
|
| 1 |
-
import os
|
| 2 |
-
|
| 3 |
-
if __name__ == "__main__":
|
| 4 |
-
run_direct_mode = os.getenv("RUN_DIRECT_MODE", "0")
|
| 5 |
-
|
| 6 |
-
if run_direct_mode == "1":
|
| 7 |
-
|
| 8 |
-
print("Attempting to import lambda_handler from lambda_entrypoint")
|
| 9 |
-
# Invoke the lambda handler
|
| 10 |
-
from lambda_entrypoint import lambda_handler
|
| 11 |
-
|
| 12 |
-
print("Imported lambda_handler from lambda_entrypoint")
|
| 13 |
-
|
| 14 |
-
else:
|
| 15 |
-
# Gradio App execution
|
| 16 |
-
from app import app, max_queue_size, max_file_size # Replace with actual import if needed
|
| 17 |
-
from tools.auth import authenticate_user
|
| 18 |
-
|
| 19 |
-
if os.getenv("COGNITO_AUTH", "0") == "1":
|
| 20 |
-
app.queue(max_size=max_queue_size).launch(show_error=True, auth=authenticate_user, max_file_size=max_file_size)
|
| 21 |
-
else:
|
| 22 |
-
app.queue(max_size=max_queue_size).launch(show_error=True, inbrowser=True, max_file_size=max_file_size)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lambda_entrypoint.py
CHANGED
|
@@ -106,11 +106,15 @@ def lambda_handler(event, context):
|
|
| 106 |
print(f"Unexpected error: {str(e)}")
|
| 107 |
raise e
|
| 108 |
|
|
|
|
|
|
|
| 109 |
# Upload output files back to S3
|
| 110 |
for root, _, files in os.walk(output_dir):
|
| 111 |
for file_name in files:
|
|
|
|
| 112 |
local_file_path = os.path.join(root, file_name)
|
| 113 |
-
output_key = f"
|
|
|
|
| 114 |
upload_file_to_s3(local_file_path, bucket_name, output_key)
|
| 115 |
|
| 116 |
return {"statusCode": 200, "body": "Processing complete."}
|
|
|
|
| 106 |
print(f"Unexpected error: {str(e)}")
|
| 107 |
raise e
|
| 108 |
|
| 109 |
+
print("Now uploading files from:", output_dir)
|
| 110 |
+
|
| 111 |
# Upload output files back to S3
|
| 112 |
for root, _, files in os.walk(output_dir):
|
| 113 |
for file_name in files:
|
| 114 |
+
print("file_name:", file_name)
|
| 115 |
local_file_path = os.path.join(root, file_name)
|
| 116 |
+
output_key = f"output/{file_name}"
|
| 117 |
+
print("Output location is:", output_key)
|
| 118 |
upload_file_to_s3(local_file_path, bucket_name, output_key)
|
| 119 |
|
| 120 |
return {"statusCode": 200, "body": "Processing complete."}
|