m7mdal7aj commited on
Commit
9eccbbe
1 Parent(s): faace7f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -2
app.py CHANGED
@@ -95,10 +95,15 @@ def perform_object_detection(image, model_name, threshold):
95
  Returns:
96
  PIL.Image, str: The image with drawn bounding boxes and a string of detected objects.
97
  """
98
-
 
 
 
 
 
99
  try:
100
  # Perform object detection and draw bounding boxes
101
- processed_image, detected_objects = detect_and_draw_objects(image, model_name, threshold)
102
  return processed_image, detected_objects
103
  except Exception as e:
104
  # Print the error for debugging
@@ -132,3 +137,4 @@ if detect_button:
132
  else:
133
  st.write("Please upload an image for object detection.")
134
 
 
 
95
  Returns:
96
  PIL.Image, str: The image with drawn bounding boxes and a string of detected objects.
97
  """
98
+
99
+ # Initialize the ObjectDetector
100
+ detector = ObjectDetector()
101
+ # Load the specified model
102
+ detector.load_model(model_name)
103
+
104
  try:
105
  # Perform object detection and draw bounding boxes
106
+ processed_image, detected_objects = detector.detect_and_draw_objects(image, model_name, threshold)
107
  return processed_image, detected_objects
108
  except Exception as e:
109
  # Print the error for debugging
 
137
  else:
138
  st.write("Please upload an image for object detection.")
139
 
140
+