sailakshmi123 commited on
Commit
8f1acfc
·
verified ·
1 Parent(s): bf274a9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -1
app.py CHANGED
@@ -47,10 +47,12 @@ if uploaded_files:
47
  image = Image.open(uploaded_file).convert("RGB")
48
  preview = image.copy()
49
  preview.thumbnail((150, 150))
50
- st.image(preview, caption="Preview", use_container_width=True)
51
 
52
  # 🧪 Preprocess image
53
  resized = image.resize((128, 128)) # Adjust size as per your model
 
 
54
  img_array = img_to_array(resized) / 255.0
55
  img_array = np.expand_dims(img_array, axis=0)
56
 
@@ -68,6 +70,8 @@ if uploaded_files:
68
 
69
  except UnidentifiedImageError:
70
  st.error("❌ Error: Invalid image file.")
 
 
71
 
72
  # 📌 Footer message
73
  st.sidebar.markdown("---")
 
47
  image = Image.open(uploaded_file).convert("RGB")
48
  preview = image.copy()
49
  preview.thumbnail((150, 150))
50
+ st.image(preview, caption="📷 Preview", use_container_width=True)
51
 
52
  # 🧪 Preprocess image
53
  resized = image.resize((128, 128)) # Adjust size as per your model
54
+ st.image(resized, caption="🧪 Resized for Model (128x128)", use_container_width=False)
55
+
56
  img_array = img_to_array(resized) / 255.0
57
  img_array = np.expand_dims(img_array, axis=0)
58
 
 
70
 
71
  except UnidentifiedImageError:
72
  st.error("❌ Error: Invalid image file.")
73
+ except Exception as e:
74
+ st.error(f"⚠️ Unexpected error: {str(e)}")
75
 
76
  # 📌 Footer message
77
  st.sidebar.markdown("---")