ssh-AI commited on
Commit
91f7ada
·
verified ·
1 Parent(s): 3164b11

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -18,14 +18,14 @@ def resize_image(img, max_height=500):
18
  img = img.resize((new_width, max_height), resample=Image.Resampling.LANCZOS)
19
  return img
20
 
21
- # --- Custom Mouse Cropper ---
22
  def custom_cropper(image, key="canvas_crop"):
23
  st.markdown("🖍️ Draw a rectangle over the area you want to crop.")
24
  canvas_result = st_canvas(
25
  fill_color="rgba(255, 165, 0, 0.3)",
26
  stroke_width=2,
27
  stroke_color="#FFA500",
28
- background_image=image,
29
  update_streamlit=True,
30
  height=image.height,
31
  width=image.width,
 
18
  img = img.resize((new_width, max_height), resample=Image.Resampling.LANCZOS)
19
  return img
20
 
21
+ # --- Custom Cropper (Fixed for Streamlit >1.30) ---
22
  def custom_cropper(image, key="canvas_crop"):
23
  st.markdown("🖍️ Draw a rectangle over the area you want to crop.")
24
  canvas_result = st_canvas(
25
  fill_color="rgba(255, 165, 0, 0.3)",
26
  stroke_width=2,
27
  stroke_color="#FFA500",
28
+ background_image=np.array(image), # ✅ Fixed: convert PIL to array
29
  update_streamlit=True,
30
  height=image.height,
31
  width=image.width,