Alex Strick van Linschoten commited on
Commit
3d9ebd2
1 Parent(s): 8b969e2

update guard clause

Browse files
Files changed (1) hide show
  1. app.py +7 -7
app.py CHANGED
@@ -155,6 +155,11 @@ def predict(pdf, confidence, generate_file):
155
  )
156
  pdf.output(report, "F")
157
 
 
 
 
 
 
158
  total_redaction_proportion = round(
159
  (total_redaction_area / total_image_areas) * 100, 1
160
  )
@@ -162,14 +167,9 @@ def predict(pdf, confidence, generate_file):
162
  (total_redaction_area / total_content_areas) * 100, 1
163
  )
164
 
165
- text_output = f"A total of {len(redacted_pages)} pages were redacted. \n\n The redacted page numbers were: {', '.join(redacted_pages)}. "
166
-
167
- if generate_file:
168
- redaction_analysis = f"{total_redaction_proportion}% of the total area of the redacted pages was redacted. \n {content_redaction_proportion}% of the actual content of those redacted pages was redacted."
169
 
170
- return text_output + redaction_analysis, images, report
171
- else:
172
- return text_output, images, None
173
 
174
 
175
  title = "Redaction Detector"
155
  )
156
  pdf.output(report, "F")
157
 
158
+ text_output = f"A total of {len(redacted_pages)} pages were redacted. \n\n The redacted page numbers were: {', '.join(redacted_pages)}. "
159
+
160
+ if not generate_file:
161
+ return text_output, images, None
162
+
163
  total_redaction_proportion = round(
164
  (total_redaction_area / total_image_areas) * 100, 1
165
  )
167
  (total_redaction_area / total_content_areas) * 100, 1
168
  )
169
 
170
+ redaction_analysis = f"{total_redaction_proportion}% of the total area of the redacted pages was redacted. \n {content_redaction_proportion}% of the actual content of those redacted pages was redacted."
 
 
 
171
 
172
+ return text_output + redaction_analysis, images, report
 
 
173
 
174
 
175
  title = "Redaction Detector"