seanpedrickcase
commited on
Commit
•
4805b1c
1
Parent(s):
5b4b5fb
App will now try to save modified redactions from user to json file.
Browse files
tools/redaction_review.py
CHANGED
@@ -120,7 +120,7 @@ def apply_redactions(image_annotated:AnnotatedImageData, file_paths:str, doc:Doc
|
|
120 |
'''
|
121 |
Apply modified redactions to a pymupdf
|
122 |
'''
|
123 |
-
print("all_image_annotations:", all_image_annotations)
|
124 |
|
125 |
output_files = []
|
126 |
|
@@ -199,10 +199,13 @@ def apply_redactions(image_annotated:AnnotatedImageData, file_paths:str, doc:Doc
|
|
199 |
output_files.append(out_pdf_file_path)
|
200 |
|
201 |
# Save the gradio_annotation_boxes to a JSON file
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
|
|
|
|
|
|
206 |
|
207 |
return doc, all_image_annotations, output_files
|
208 |
|
|
|
120 |
'''
|
121 |
Apply modified redactions to a pymupdf
|
122 |
'''
|
123 |
+
#print("all_image_annotations:", all_image_annotations)
|
124 |
|
125 |
output_files = []
|
126 |
|
|
|
199 |
output_files.append(out_pdf_file_path)
|
200 |
|
201 |
# Save the gradio_annotation_boxes to a JSON file
|
202 |
+
try:
|
203 |
+
out_annotation_file_path = output_folder + file_base + '_modified_redactions.json'
|
204 |
+
with open(out_annotation_file_path, 'w') as f:
|
205 |
+
json.dump(all_image_annotations, f)
|
206 |
+
output_files.append(out_annotation_file_path)
|
207 |
+
except:
|
208 |
+
print("Could not save annotations to json file.")
|
209 |
|
210 |
return doc, all_image_annotations, output_files
|
211 |
|