Spaces:
Sleeping
Sleeping
| 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) | |