update app.py
Browse files
app.py
CHANGED
@@ -30,11 +30,12 @@ def read_image(image_file: bytes = File(...)):
|
|
30 |
results = processor.post_process_object_detection(outputs, target_sizes=target_sizes, threshold=0.9)[0]
|
31 |
print("results pushed")
|
32 |
response = {}
|
33 |
-
|
34 |
-
response['labels'] = results['labels']
|
35 |
-
response['boxes'] = results['boxes']
|
36 |
for score, label, box in zip(results["scores"], results["labels"], results["boxes"]):
|
37 |
box = [round(i, 2) for i in box.tolist()]
|
|
|
|
|
|
|
38 |
print(model.config.id2label[label.item()])
|
39 |
print(score.item())
|
40 |
print(box)
|
|
|
30 |
results = processor.post_process_object_detection(outputs, target_sizes=target_sizes, threshold=0.9)[0]
|
31 |
print("results pushed")
|
32 |
response = {}
|
33 |
+
|
|
|
|
|
34 |
for score, label, box in zip(results["scores"], results["labels"], results["boxes"]):
|
35 |
box = [round(i, 2) for i in box.tolist()]
|
36 |
+
response['scores'] = model.config.id2label[label.item()]
|
37 |
+
response['labels'] = score.item()
|
38 |
+
response['boxes'] = box
|
39 |
print(model.config.id2label[label.item()])
|
40 |
print(score.item())
|
41 |
print(box)
|