Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -72,8 +72,8 @@ def run_grounding(input_image, grounding_caption, box_threshold, text_threshold)
|
|
72 |
lines = []
|
73 |
for label, xyxy, conf in zip(labels, boxes, confidences):
|
74 |
x1, y1, x2, y2 = [int(round(v)) for v in xyxy]
|
75 |
-
# Format: class top_left_x, top_left_y, bot_x, bot_y
|
76 |
-
lines.append(f"{label} {x1}, {y1}, {x2}, {y2}")
|
77 |
detection_text = "\n".join(lines)
|
78 |
else:
|
79 |
detection_text = "No detections."
|
@@ -168,7 +168,7 @@ if __name__ == "__main__":
|
|
168 |
type="pil"
|
169 |
)
|
170 |
det_text = gr.Textbox(
|
171 |
-
label="Detections (class top_left_x, top_left_y, bot_x, bot_y)",
|
172 |
lines=12,
|
173 |
interactive=False,
|
174 |
show_copy_button=True
|
|
|
72 |
lines = []
|
73 |
for label, xyxy, conf in zip(labels, boxes, confidences):
|
74 |
x1, y1, x2, y2 = [int(round(v)) for v in xyxy]
|
75 |
+
# Format: class confidence top_left_x, top_left_y, bot_x, bot_y
|
76 |
+
lines.append(f"{label} {conf:.3f} {x1}, {y1}, {x2}, {y2}")
|
77 |
detection_text = "\n".join(lines)
|
78 |
else:
|
79 |
detection_text = "No detections."
|
|
|
168 |
type="pil"
|
169 |
)
|
170 |
det_text = gr.Textbox(
|
171 |
+
label="Detections (class confidence top_left_x, top_left_y, bot_x, bot_y)",
|
172 |
lines=12,
|
173 |
interactive=False,
|
174 |
show_copy_button=True
|