Hamam commited on
Commit
759e430
·
verified ·
1 Parent(s): 2eb5aa7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -6
app.py CHANGED
@@ -82,16 +82,19 @@ def fix_image(upload=None):
82
 
83
  image = Image.open(upload)
84
 
85
- # Display the original image
86
- st.image(image, caption="Uploaded Image", use_column_width=True)
87
-
88
  # Prepare image for segmentation
89
  image_batch = prepare_single_image(image, resize_shape, transforms, "cpu")
90
  prediction_u2net = prepare_prediction(u2net, image_batch)
91
  masked_image = apply_mask(image, prediction_u2net)
92
-
93
- # Display segmented image
94
- st.image(masked_image, caption='Segmented Image', use_column_width=True)
 
 
 
 
 
 
95
 
96
  # Provide download option for segmented image
97
  buf = io.BytesIO()
 
82
 
83
  image = Image.open(upload)
84
 
 
 
 
85
  # Prepare image for segmentation
86
  image_batch = prepare_single_image(image, resize_shape, transforms, "cpu")
87
  prediction_u2net = prepare_prediction(u2net, image_batch)
88
  masked_image = apply_mask(image, prediction_u2net)
89
+
90
+ # Display the original and segmented images side by side
91
+ col1, col2 = st.columns(2)
92
+
93
+ with col1:
94
+ st.image(image, caption="Uploaded Image", use_column_width=True)
95
+
96
+ with col2:
97
+ st.image(masked_image, caption='Segmented Image', use_column_width=True)
98
 
99
  # Provide download option for segmented image
100
  buf = io.BytesIO()