ayoubsa commited on
Commit
1fbedbf
·
verified ·
1 Parent(s): 534f8cc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -0
app.py CHANGED
@@ -183,6 +183,14 @@ def predict(image):
183
  results = model.predict(image) # Perform object detection
184
  print("YOLO prediction completed.")
185
 
 
 
 
 
 
 
 
 
186
  # Render bounding boxes on the image
187
  results.render()
188
  print("Bounding boxes rendered.")
@@ -209,3 +217,4 @@ iface = gr.Interface(
209
  # Launch the Gradio app
210
  iface.launch()
211
 
 
 
183
  results = model.predict(image) # Perform object detection
184
  print("YOLO prediction completed.")
185
 
186
+ # Print detected class names
187
+ detected_classes = results.names # Get class names for each detected object
188
+ print("Detected classes:", detected_classes)
189
+
190
+ # Print the names of the detected classes
191
+ for i, name in enumerate(detected_classes):
192
+ print(f"Detected object {i+1}: {name}")
193
+
194
  # Render bounding boxes on the image
195
  results.render()
196
  print("Bounding boxes rendered.")
 
217
  # Launch the Gradio app
218
  iface.launch()
219
 
220
+