Kaushik Bar
commited on
Commit
·
a1c2ab5
1
Parent(s):
368eab3
adding yoloxl
Browse files
app.py
CHANGED
@@ -59,14 +59,14 @@ def visualize_prediction(pil_img, output_dict, threshold=0.7, id2label=None):
|
|
59 |
|
60 |
def detect_objects(model_name,url_input,image_input,threshold):
|
61 |
if 'detr' in model_name:
|
62 |
-
model = DetrForObjectDetection.from_pretrained(model_name
|
63 |
-
|
64 |
elif 'yolos' in model_name:
|
65 |
model = YolosForObjectDetection.from_pretrained(model_name)
|
66 |
-
|
67 |
elif 'yolox' in model_name:
|
68 |
model = YOLOXL(pretrained="coco")
|
69 |
-
|
70 |
|
71 |
if validators.url(url_input):
|
72 |
image = Image.open(requests.get(url_input, stream=True).raw)
|
|
|
59 |
|
60 |
def detect_objects(model_name,url_input,image_input,threshold):
|
61 |
if 'detr' in model_name:
|
62 |
+
model = DetrForObjectDetection.from_pretrained(model_name)
|
63 |
+
feature_extractor = AutoFeatureExtractor.from_pretrained(model_name)
|
64 |
elif 'yolos' in model_name:
|
65 |
model = YolosForObjectDetection.from_pretrained(model_name)
|
66 |
+
feature_extractor = AutoFeatureExtractor.from_pretrained(model_name)
|
67 |
elif 'yolox' in model_name:
|
68 |
model = YOLOXL(pretrained="coco")
|
69 |
+
feature_extractor = model.preprocess_input
|
70 |
|
71 |
if validators.url(url_input):
|
72 |
image = Image.open(requests.get(url_input, stream=True).raw)
|