JosephTK commited on
Commit
4199c36
·
1 Parent(s): bc50303

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -1
app.py CHANGED
@@ -23,7 +23,14 @@ def detect(image):
23
  # label and the count
24
  counts = {}
25
 
26
- return results
 
 
 
 
 
 
 
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,