Spaces:
Running
on
Zero
Running
on
Zero
label name
Browse files
app.py
CHANGED
|
@@ -54,9 +54,8 @@ def detect(model, processor, image: Image.Image, prompts: list, threshold: float
|
|
| 54 |
)
|
| 55 |
result = results[0]
|
| 56 |
annotations = []
|
| 57 |
-
for box, score,
|
| 58 |
if score >= threshold:
|
| 59 |
-
label_name = prompts[label]
|
| 60 |
xmin, ymin, xmax, ymax = [int(x) for x in box.tolist()]
|
| 61 |
annotations.append(((xmin, ymin, xmax, ymax), f"{label_name} {score:.2f}"))
|
| 62 |
elapsed_ms = (time.perf_counter() - t0) * 1000
|
|
|
|
| 54 |
)
|
| 55 |
result = results[0]
|
| 56 |
annotations = []
|
| 57 |
+
for box, score, label_name in zip(result["boxes"], result["scores"], result["text_labels"]):
|
| 58 |
if score >= threshold:
|
|
|
|
| 59 |
xmin, ymin, xmax, ymax = [int(x) for x in box.tolist()]
|
| 60 |
annotations.append(((xmin, ymin, xmax, ymax), f"{label_name} {score:.2f}"))
|
| 61 |
elapsed_ms = (time.perf_counter() - t0) * 1000
|