Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -23,7 +23,14 @@ def detect(image):
|
|
23 |
# label and the count
|
24 |
counts = {}
|
25 |
|
26 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
|
28 |
demo = gr.Interface(
|
29 |
fn=detect,
|
|
|
23 |
# label and the count
|
24 |
counts = {}
|
25 |
|
26 |
+
for score, label, box in zip(results["scores"], results["labels"], results["boxes"]):
|
27 |
+
box = [round(i, 2) for i in box.tolist()]
|
28 |
+
label_name = model.config.id2label[label.item()]
|
29 |
+
if label_name not in counts:
|
30 |
+
counts[label_name] = 0
|
31 |
+
counts[label_name] += 1
|
32 |
+
|
33 |
+
return counts
|
34 |
|
35 |
demo = gr.Interface(
|
36 |
fn=detect,
|