Spaces:
Sleeping
Sleeping
Hamam
commited on
Update app.py
Browse files
app.py
CHANGED
|
@@ -76,11 +76,10 @@ uploaded_file = st.sidebar.file_uploader("Choose an image...", type=["png", "jpg
|
|
| 76 |
|
| 77 |
# Function to handle image and segmentation display
|
| 78 |
def fix_image(upload=None):
|
| 79 |
-
if upload
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
image = Image.open(upload)
|
| 84 |
|
| 85 |
# Prepare image for segmentation
|
| 86 |
image_batch = prepare_single_image(image, resize_shape, transforms, "cpu")
|
|
@@ -108,6 +107,8 @@ def fix_image(upload=None):
|
|
| 108 |
mime="image/png"
|
| 109 |
)
|
| 110 |
|
| 111 |
-
|
| 112 |
if uploaded_file is not None:
|
| 113 |
fix_image(upload=uploaded_file)
|
|
|
|
|
|
|
|
|
| 76 |
|
| 77 |
# Function to handle image and segmentation display
|
| 78 |
def fix_image(upload=None):
|
| 79 |
+
if upload:
|
| 80 |
+
image = Image.open(upload)
|
| 81 |
+
else:
|
| 82 |
+
image = Image.open("8.jpg")
|
|
|
|
| 83 |
|
| 84 |
# Prepare image for segmentation
|
| 85 |
image_batch = prepare_single_image(image, resize_shape, transforms, "cpu")
|
|
|
|
| 107 |
mime="image/png"
|
| 108 |
)
|
| 109 |
|
| 110 |
+
|
| 111 |
if uploaded_file is not None:
|
| 112 |
fix_image(upload=uploaded_file)
|
| 113 |
+
else:
|
| 114 |
+
fix_image() # Use default image if none uploaded
|