ssh-AI commited on
Commit
833d8f3
·
verified ·
1 Parent(s): fcb64ac

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -7
app.py CHANGED
@@ -10,12 +10,12 @@ from streamlit_cropper import st_cropper
10
  # --- PAGE CONFIG ---
11
  st.set_page_config(page_title="Smart Doc Scanner", page_icon="🖼️", layout="centered")
12
 
13
- # --- Resize Function ---
14
- def resize_image(img, max_width=800):
15
- if img.width > max_width:
16
- ratio = max_width / img.width
17
- new_height = int(img.height * ratio)
18
- img = img.resize((max_width, new_height), resample=Image.Resampling.LANCZOS)
19
  return img
20
 
21
  # --- HEADER ---
@@ -62,7 +62,6 @@ if uploaded_files:
62
 
63
  col_cropper, col_preview = st.columns([1, 1])
64
 
65
- # --- Hugging Face-safe cropper ---
66
  with col_cropper:
67
  st.markdown("### ✂️ Select Crop Area (Original Image):")
68
  crop_output = st_cropper(
 
10
  # --- PAGE CONFIG ---
11
  st.set_page_config(page_title="Smart Doc Scanner", page_icon="🖼️", layout="centered")
12
 
13
+ # --- Resize Function (Height Based) ---
14
+ def resize_image(img, max_height=500):
15
+ if img.height > max_height:
16
+ ratio = max_height / img.height
17
+ new_width = int(img.width * ratio)
18
+ img = img.resize((new_width, max_height), resample=Image.Resampling.LANCZOS)
19
  return img
20
 
21
  # --- HEADER ---
 
62
 
63
  col_cropper, col_preview = st.columns([1, 1])
64
 
 
65
  with col_cropper:
66
  st.markdown("### ✂️ Select Crop Area (Original Image):")
67
  crop_output = st_cropper(