Commit
·
dea568f
1
Parent(s):
7907ad4
Added concurrency limit to run options. Trying again to load in zoom/rotate options from gradio_image_annotator fork.
Browse files- app.py +5 -2
- requirements.txt +3 -3
- tools/file_redaction.py +1 -1
app.py
CHANGED
@@ -542,14 +542,17 @@ print(f'The value of GRADIO_SERVER_PORT is {GRADIO_SERVER_PORT}')
|
|
542 |
ROOT_PATH = get_or_create_env_var('ROOT_PATH', '')
|
543 |
print(f'The value of ROOT_PATH is {ROOT_PATH}')
|
544 |
|
|
|
|
|
|
|
545 |
if __name__ == "__main__":
|
546 |
|
547 |
if RUN_DIRECT_MODE == "0":
|
548 |
|
549 |
if os.environ['COGNITO_AUTH'] == "1":
|
550 |
-
app.queue(max_size=MAX_QUEUE_SIZE).launch(show_error=True, auth=authenticate_user, max_file_size=MAX_FILE_SIZE, server_port=GRADIO_SERVER_PORT, root_path=ROOT_PATH)
|
551 |
else:
|
552 |
-
app.queue(max_size=MAX_QUEUE_SIZE).launch(show_error=True, inbrowser=True, max_file_size=MAX_FILE_SIZE, server_port=GRADIO_SERVER_PORT, root_path=ROOT_PATH)
|
553 |
|
554 |
else:
|
555 |
from tools.cli_redact import main
|
|
|
542 |
ROOT_PATH = get_or_create_env_var('ROOT_PATH', '')
|
543 |
print(f'The value of ROOT_PATH is {ROOT_PATH}')
|
544 |
|
545 |
+
DEFAULT_CONCURRENCY_LIMIT = get_or_create_env_var('DEFAULT_CONCURRENCY_LIMIT', '3')
|
546 |
+
print(f'The value of ROOT_PATH is {DEFAULT_CONCURRENCY_LIMIT}')
|
547 |
+
|
548 |
if __name__ == "__main__":
|
549 |
|
550 |
if RUN_DIRECT_MODE == "0":
|
551 |
|
552 |
if os.environ['COGNITO_AUTH'] == "1":
|
553 |
+
app.queue(max_size=int(MAX_QUEUE_SIZE), default_concurrency_limit=int(DEFAULT_CONCURRENCY_LIMIT)).launch(show_error=True, auth=authenticate_user, max_file_size=MAX_FILE_SIZE, server_port=GRADIO_SERVER_PORT, root_path=ROOT_PATH)
|
554 |
else:
|
555 |
+
app.queue(max_size=int(MAX_QUEUE_SIZE), default_concurrency_limit=int(DEFAULT_CONCURRENCY_LIMIT)).launch(show_error=True, inbrowser=True, max_file_size=MAX_FILE_SIZE, server_port=GRADIO_SERVER_PORT, root_path=ROOT_PATH)
|
556 |
|
557 |
else:
|
558 |
from tools.cli_redact import main
|
requirements.txt
CHANGED
@@ -19,9 +19,9 @@ openpyxl==3.1.2
|
|
19 |
Faker==22.2.0
|
20 |
python-levenshtein==0.26.1
|
21 |
spaczz==0.6.1
|
22 |
-
gradio_image_annotation==0.2.5
|
23 |
-
# The following version includes rotation and image zoom options
|
24 |
-
|
25 |
rapidfuzz==3.12.1
|
26 |
numpy==1.26.4
|
27 |
awslambdaric==3.0.0
|
|
|
19 |
Faker==22.2.0
|
20 |
python-levenshtein==0.26.1
|
21 |
spaczz==0.6.1
|
22 |
+
#gradio_image_annotation==0.2.5
|
23 |
+
# The following version includes rotation and image zoom options
|
24 |
+
https://github.com/seanpedrick-case/gradio_image_annotator/releases/download/v0.3.0/gradio_image_annotation-0.3.0-py3-none-any.whl
|
25 |
rapidfuzz==3.12.1
|
26 |
numpy==1.26.4
|
27 |
awslambdaric==3.0.0
|
tools/file_redaction.py
CHANGED
@@ -1153,7 +1153,7 @@ def redact_image_pdf(file_path:str,
|
|
1153 |
text_blocks, new_request_metadata = analyse_page_with_textract(pdf_page_as_bytes, reported_page_number, textract_client, handwrite_signature_checkbox) # Analyse page with Textract
|
1154 |
except Exception as e:
|
1155 |
print("Textract extraction for page", reported_page_number, "failed due to:", e)
|
1156 |
-
|
1157 |
new_request_metadata = "Failed Textract API call"
|
1158 |
|
1159 |
# Check if "pages" key exists, if not, initialize it as an empty list
|
|
|
1153 |
text_blocks, new_request_metadata = analyse_page_with_textract(pdf_page_as_bytes, reported_page_number, textract_client, handwrite_signature_checkbox) # Analyse page with Textract
|
1154 |
except Exception as e:
|
1155 |
print("Textract extraction for page", reported_page_number, "failed due to:", e)
|
1156 |
+
text_blocks = []
|
1157 |
new_request_metadata = "Failed Textract API call"
|
1158 |
|
1159 |
# Check if "pages" key exists, if not, initialize it as an empty list
|