Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -114,20 +114,21 @@ if detect_button:
|
|
114 |
image = Image.open(image)
|
115 |
# Display the original image
|
116 |
st.image(image, use_column_width=True, caption="Original Image")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
117 |
except Exception as e:
|
118 |
st.error(f"Error loading image: {e}")
|
119 |
-
return
|
120 |
|
121 |
-
# Perform object detection
|
122 |
-
processed_image, detected_objects = perform_object_detection(image, detect_model, threshold)
|
123 |
-
|
124 |
-
if processed_image:
|
125 |
-
# Display the image with detected objects
|
126 |
-
st.image(processed_image, use_column_width=True, caption="Image with Detected Objects")
|
127 |
-
else:
|
128 |
-
st.error("Failed to process image for object detection.")
|
129 |
-
|
130 |
-
# Display the detected objects as text
|
131 |
-
st.write(detected_objects)
|
132 |
else:
|
133 |
st.write("Please upload an image for object detection.")
|
|
|
|
114 |
image = Image.open(image)
|
115 |
# Display the original image
|
116 |
st.image(image, use_column_width=True, caption="Original Image")
|
117 |
+
|
118 |
+
# Perform object detection
|
119 |
+
processed_image, detected_objects = perform_object_detection(image, detect_model, threshold)
|
120 |
+
|
121 |
+
if processed_image:
|
122 |
+
# Display the image with detected objects
|
123 |
+
st.image(processed_image, use_column_width=True, caption="Image with Detected Objects")
|
124 |
+
# Display the detected objects as text
|
125 |
+
st.write(detected_objects)
|
126 |
+
else:
|
127 |
+
st.error("Failed to process image for object detection.")
|
128 |
+
|
129 |
except Exception as e:
|
130 |
st.error(f"Error loading image: {e}")
|
|
|
131 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
132 |
else:
|
133 |
st.write("Please upload an image for object detection.")
|
134 |
+
|