pratikshahp commited on
Commit
8605c62
·
verified ·
1 Parent(s): 8b37eed

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -5
app.py CHANGED
@@ -2,13 +2,14 @@ from transformers import pipeline
2
 
3
  def prettier(results):
4
  for item in results:
5
- score = round(item['score'],3)
6
- label = item('label')
7
- location = [round(value,2) for value in item['box'].values()]
8
- print(f'Detected{label} with confidence {score} at location {location}')
9
 
10
- pipe = pipeline("object-detection",model="facebook/detr-resnet-50")
11
  output = pipe("multi-object.jpg")
12
  print("Object Detection: ")
13
  prettier(output)
14
 
 
 
2
 
3
  def prettier(results):
4
  for item in results:
5
+ score = round(item['score'], 3)
6
+ label = item['label'] # Use square brackets to access the 'label' key
7
+ location = [round(value, 2) for value in item['box'].values()]
8
+ print(f'Detected {label} with confidence {score} at location {location}')
9
 
10
+ pipe = pipeline("object-detection", model="facebook/detr-resnet-50")
11
  output = pipe("multi-object.jpg")
12
  print("Object Detection: ")
13
  prettier(output)
14
 
15
+