Update app.py
Browse files
app.py
CHANGED
@@ -42,8 +42,6 @@ def calculate_bounding_box_area(results):
|
|
42 |
areas = []
|
43 |
class_names = []
|
44 |
|
45 |
-
print(results)
|
46 |
-
|
47 |
# Iterate through all bounding boxes
|
48 |
for box in results[0].boxes:
|
49 |
x1, y1, x2, y2 = map(int, box.xyxy[0].tolist()) # Bounding box coordinates
|
@@ -73,10 +71,7 @@ def process_image(uploaded_file):
|
|
73 |
|
74 |
# Function to run YOLO inference
|
75 |
def run_yolo(image):
|
76 |
-
|
77 |
-
image_cv = cv2.cvtColor(image_cv, cv2.COLOR_RGB2BGR)
|
78 |
-
|
79 |
-
results = model(image_cv) # Run YOLOv8 detection
|
80 |
|
81 |
detected_classes, bounding_areas = calculate_bounding_box_area(results)
|
82 |
|
|
|
42 |
areas = []
|
43 |
class_names = []
|
44 |
|
|
|
|
|
45 |
# Iterate through all bounding boxes
|
46 |
for box in results[0].boxes:
|
47 |
x1, y1, x2, y2 = map(int, box.xyxy[0].tolist()) # Bounding box coordinates
|
|
|
71 |
|
72 |
# Function to run YOLO inference
|
73 |
def run_yolo(image):
|
74 |
+
results = model(image) # Run YOLOv8 detection with PIL image directly
|
|
|
|
|
|
|
75 |
|
76 |
detected_classes, bounding_areas = calculate_bounding_box_area(results)
|
77 |
|