Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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
|
| 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 |
+
|