Update app.py
Browse filesUsed wrong parameter in python sorted ...
app.py
CHANGED
|
@@ -89,7 +89,7 @@ def detect_objects(model_name,url_input,image_input,threshold):
|
|
| 89 |
|
| 90 |
final_str_abv = ""
|
| 91 |
final_str_else = ""
|
| 92 |
-
for score, label, box in sorted(zip(processed_outputs["scores"], processed_outputs["labels"], processed_outputs["boxes"]), key = lambda x: x[0].item(),
|
| 93 |
box = [round(i, 2) for i in box.tolist()]
|
| 94 |
if score.item() >= threshold:
|
| 95 |
final_str_abv += f"Detected `{model.config.id2label[label.item()]}` with confidence `{round(score.item(), 3)}` at location `{box}`\n"
|
|
|
|
| 89 |
|
| 90 |
final_str_abv = ""
|
| 91 |
final_str_else = ""
|
| 92 |
+
for score, label, box in sorted(zip(processed_outputs["scores"], processed_outputs["labels"], processed_outputs["boxes"]), key = lambda x: x[0].item(), reverse=True):
|
| 93 |
box = [round(i, 2) for i in box.tolist()]
|
| 94 |
if score.item() >= threshold:
|
| 95 |
final_str_abv += f"Detected `{model.config.id2label[label.item()]}` with confidence `{round(score.item(), 3)}` at location `{box}`\n"
|