pratikshahp commited on
Commit
51a73df
·
verified ·
1 Parent(s): 41c35a9

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -0
app.py ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from transformer import pipeline
2
+ pipe = pipeline("object-detection",model="facebook/detr-resnet-50")
3
+ output = pipe("multi-object.jpg")
4
+ prettier(output)
5
+
6
+ def prettier(results):
7
+ for item in results:
8
+ score = round(item['score'],3)
9
+ label = item('label')
10
+ location = [round(value,2) for value in item['box'].values()]
11
+ print(f'Detected{label} with confidence {score} at location {location}')