milwright commited on
Commit
793fc87
·
1 Parent(s): ef270a4

Show preprocessing preview only when substantive options are selected

Browse files

Only show preprocessing options and preview when meaningful options like grayscale,
threshold, denoise, or contrast adjustments are selected, rather than just rotation.

Files changed (1) hide show
  1. app.py +9 -4
app.py CHANGED
@@ -511,8 +511,13 @@ with main_tab1:
511
  help="Select a document to process with OCR")
512
  st.markdown('</div>', unsafe_allow_html=True)
513
 
514
- # Show preprocessing summary if options are selected
515
- if uploaded_file is not None and any(preprocessing_options.values()):
 
 
 
 
 
516
  st.write("**Active preprocessing:**")
517
  prep_list = []
518
 
@@ -577,8 +582,8 @@ with main_tab1:
577
  except Exception:
578
  st.info("Image preview could not be displayed")
579
 
580
- # Add processed preview if preprocessing options are selected
581
- if any(preprocessing_options.values()):
582
  # Create a before-after comparison
583
  st.subheader("Preprocessing Preview")
584
 
 
511
  help="Select a document to process with OCR")
512
  st.markdown('</div>', unsafe_allow_html=True)
513
 
514
+ # Show preprocessing summary only if substantive options are selected
515
+ substantive_options = (preprocessing_options.get("grayscale", False) or
516
+ preprocessing_options.get("threshold", False) or
517
+ preprocessing_options.get("denoise", False) or
518
+ preprocessing_options.get("contrast", 0) != 0)
519
+
520
+ if uploaded_file is not None and substantive_options:
521
  st.write("**Active preprocessing:**")
522
  prep_list = []
523
 
 
582
  except Exception:
583
  st.info("Image preview could not be displayed")
584
 
585
+ # Add processed preview ONLY if substantive preprocessing options are selected
586
+ if preprocessing_options.get("grayscale", False) or preprocessing_options.get("threshold", False) or preprocessing_options.get("denoise", False) or preprocessing_options.get("contrast", 0) != 0:
587
  # Create a before-after comparison
588
  st.subheader("Preprocessing Preview")
589