Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -99,10 +99,9 @@ def perform_object_detection(image, model_name, threshold):
|
|
99 |
|
100 |
|
101 |
# Perform object detection and draw bounding boxes
|
102 |
-
|
103 |
processed_image, detected_objects = detect_and_draw_objects(image, model_name, threshold)
|
104 |
-
|
105 |
-
st.write(detected_objects[:20])
|
106 |
return processed_image, detected_objects
|
107 |
|
108 |
|
@@ -113,25 +112,20 @@ if detect_button:
|
|
113 |
# Open the uploaded image
|
114 |
try:
|
115 |
image = Image.open(image)
|
116 |
-
|
117 |
# Display the original image
|
118 |
st.image(image, use_column_width=True, caption="Original Image")
|
119 |
-
|
120 |
# Perform object detection
|
121 |
processed_image, detected_objects = perform_object_detection(image, detect_model, threshold)
|
122 |
-
|
123 |
-
|
124 |
-
st.write(processed_image)
|
125 |
-
st.write(type(processed_image))
|
126 |
-
#if processed_image:
|
127 |
# Display the image with detected objects
|
128 |
st.image(processed_image, use_column_width=True, caption="Image with Detected Objects")
|
129 |
-
|
130 |
# Display the detected objects as text
|
131 |
st.write(detected_objects)
|
132 |
-
|
133 |
-
#else:
|
134 |
-
# st.error("Failed to process image for object detection.")
|
135 |
|
136 |
except Exception as e:
|
137 |
st.error(f"Error loading image: {e}")
|
|
|
99 |
|
100 |
|
101 |
# Perform object detection and draw bounding boxes
|
102 |
+
|
103 |
processed_image, detected_objects = detect_and_draw_objects(image, model_name, threshold)
|
104 |
+
|
|
|
105 |
return processed_image, detected_objects
|
106 |
|
107 |
|
|
|
112 |
# Open the uploaded image
|
113 |
try:
|
114 |
image = Image.open(image)
|
115 |
+
|
116 |
# Display the original image
|
117 |
st.image(image, use_column_width=True, caption="Original Image")
|
118 |
+
|
119 |
# Perform object detection
|
120 |
processed_image, detected_objects = perform_object_detection(image, detect_model, threshold)
|
121 |
+
|
122 |
+
|
|
|
|
|
|
|
123 |
# Display the image with detected objects
|
124 |
st.image(processed_image, use_column_width=True, caption="Image with Detected Objects")
|
125 |
+
|
126 |
# Display the detected objects as text
|
127 |
st.write(detected_objects)
|
128 |
+
|
|
|
|
|
129 |
|
130 |
except Exception as e:
|
131 |
st.error(f"Error loading image: {e}")
|