Spaces:
Running
Running
Create app.py
Browse files
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}')
|