Spaces:
Paused
Paused
updating the detection model from owl-vit to owl-v2
Browse files
app.py
CHANGED
@@ -83,10 +83,10 @@ def run_image_captioner(image, device):
|
|
83 |
|
84 |
@spaces.GPU()
|
85 |
def run_segmentation(image, object_to_segment, device):
|
86 |
-
# OWL-
|
87 |
-
|
88 |
-
processor =
|
89 |
-
od_model =
|
90 |
text_queries = [object_to_segment]
|
91 |
inputs = processor(text=text_queries, images=image, return_tensors="pt").to(device)
|
92 |
with torch.no_grad():
|
|
|
83 |
|
84 |
@spaces.GPU()
|
85 |
def run_segmentation(image, object_to_segment, device):
|
86 |
+
# OWL-V2 for object detection
|
87 |
+
owl_v2_model_id = "google/owlv2-base-patch16-ensemble"
|
88 |
+
processor = Owlv2Processor.from_pretrained(owl_vit_model_id)
|
89 |
+
od_model = Owlv2ForObjectDetection.from_pretrained(owl_vit_model_id).to(device)
|
90 |
text_queries = [object_to_segment]
|
91 |
inputs = processor(text=text_queries, images=image, return_tensors="pt").to(device)
|
92 |
with torch.no_grad():
|