pratikshahp's picture
Update app.py
c7f2763 verified
raw
history blame contribute delete
545 Bytes
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)