Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -4,12 +4,14 @@ from transformers import DetrForObjectDetection, DetrImageProcessor, AutoModel
|
|
4 |
import supervision as sv
|
5 |
from supervision.detection.annotate import BoxAnnotator
|
6 |
from supervision.utils.notebook import plot_image
|
|
|
7 |
|
8 |
og_model = 'facebook/detr-resnet-50'
|
9 |
image_processor = DetrImageProcessor.from_pretrained(og_model)
|
10 |
model = AutoModel.from_pretrained("taroii/notfinetuned-detr-50")
|
11 |
|
12 |
-
def predict(
|
|
|
13 |
with torch.no_grad():
|
14 |
# load image and predict
|
15 |
inputs = image_processor(images=image, return_tensors='pt')
|
|
|
4 |
import supervision as sv
|
5 |
from supervision.detection.annotate import BoxAnnotator
|
6 |
from supervision.utils.notebook import plot_image
|
7 |
+
import cv2
|
8 |
|
9 |
og_model = 'facebook/detr-resnet-50'
|
10 |
image_processor = DetrImageProcessor.from_pretrained(og_model)
|
11 |
model = AutoModel.from_pretrained("taroii/notfinetuned-detr-50")
|
12 |
|
13 |
+
def predict(image_path):
|
14 |
+
image = cv2.imread(image_path)
|
15 |
with torch.no_grad():
|
16 |
# load image and predict
|
17 |
inputs = image_processor(images=image, return_tensors='pt')
|