File size: 545 Bytes
b0991f0
c7f2763
 
51a73df
 
8605c62
 
 
 
8b37eed
8605c62
8b37eed
 
 
f30bff4
8605c62
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
from transformers import pipeline
import streamlit as st

def prettier(results):
    for item in results:
        score = round(item['score'], 3)
        label = item['label']  # Use square brackets to access the 'label' key
        location = [round(value, 2) for value in item['box'].values()]
        print(f'Detected {label} with confidence {score} at location {location}')

pipe = pipeline("object-detection", model="facebook/detr-resnet-50")
output = pipe("multi-object.jpg")
print("Object Detection: ")
prettier(output)
st.write(output)