mirror of
https://github.com/HumanAIGC-Engineering/gradio-webrtc.git
synced 2026-02-05 18:09:23 +08:00
Add code
This commit is contained in:
@@ -25,7 +25,7 @@ def draw_bounding_boxes(image, results: dict, model, threshold=0.3):
|
||||
color = get_color(label)
|
||||
|
||||
# Draw bounding box
|
||||
draw.rectangle(box, outline=color, width=3) # type: ignore
|
||||
draw.rectangle(box, outline=color, width=3) # type: ignore
|
||||
|
||||
# Prepare text
|
||||
text = f"{label}: {score:.2f}"
|
||||
@@ -35,8 +35,8 @@ def draw_bounding_boxes(image, results: dict, model, threshold=0.3):
|
||||
|
||||
# Draw text background
|
||||
draw.rectangle(
|
||||
[box[0], box[1] - text_height - 4, box[0] + text_width, box[1]], # type: ignore
|
||||
fill=color, # type: ignore
|
||||
[box[0], box[1] - text_height - 4, box[0] + text_width, box[1]], # type: ignore
|
||||
fill=color, # type: ignore
|
||||
)
|
||||
|
||||
# Draw text
|
||||
|
||||
Reference in New Issue
Block a user