ariG23498 HF Staff commited on
Commit
9fc3606
·
1 Parent(s): edd8a11

label name

Browse files
Files changed (1) hide show
  1. app.py +1 -2
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, label in zip(result["boxes"], result["scores"], result["labels"]):
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