paoyingheng
commited on
Commit
·
adb423a
1
Parent(s):
cf43e68
updates
Browse files
app.py
CHANGED
@@ -16,7 +16,9 @@ def para_func(image: gr.Image = None, image_size: gr.Slider = 640, conf_threshol
|
|
16 |
box = results[0].boxes
|
17 |
print("Object type:", box.cls)
|
18 |
print("Coordinates:", box.xyxy)
|
19 |
-
|
|
|
|
|
20 |
|
21 |
# Render the output image with bounding boxes around detected objects
|
22 |
render = render_result(model=model, image=image, result=results[0])
|
|
|
16 |
box = results[0].boxes
|
17 |
print("Object type:", box.cls)
|
18 |
print("Coordinates:", box.xyxy)
|
19 |
+
probability_percentage = box.conf.item() * 100 # Converts the tensor to a float
|
20 |
+
print("Probability:", f'{probability_percentage:.1f}%')
|
21 |
+
|
22 |
|
23 |
# Render the output image with bounding boxes around detected objects
|
24 |
render = render_result(model=model, image=image, result=results[0])
|