Spaces:
Runtime error
Runtime error
remove print lines
Browse files
app.py
CHANGED
|
@@ -18,20 +18,14 @@ processor = OwlViTProcessor.from_pretrained("google/owlvit-base-patch32")
|
|
| 18 |
|
| 19 |
def image_guided_detection(img, query_img, score_threshold, nms_threshold):
|
| 20 |
target_sizes = torch.Tensor([img.size[::-1]])
|
| 21 |
-
print(target_sizes)
|
| 22 |
-
print(type(img), type(query_img))
|
| 23 |
-
print(img.size)
|
| 24 |
-
print(query_img.size)
|
| 25 |
inputs = processor(query_images=query_img, images=img, return_tensors="pt").to(device)
|
| 26 |
-
print(inputs)
|
| 27 |
-
print()
|
| 28 |
|
| 29 |
with torch.no_grad():
|
| 30 |
outputs = model.image_guided_detection(**inputs)
|
| 31 |
|
| 32 |
outputs.logits = outputs.logits.cpu()
|
| 33 |
outputs.pred_boxes = outputs.target_pred_boxes.cpu()
|
| 34 |
-
|
| 35 |
results = processor.post_process_image_guided_detection(
|
| 36 |
outputs=outputs,
|
| 37 |
threshold=score_threshold,
|
|
@@ -82,4 +76,4 @@ demo = gr.Interface(
|
|
| 82 |
]
|
| 83 |
)
|
| 84 |
|
| 85 |
-
demo.launch(
|
|
|
|
| 18 |
|
| 19 |
def image_guided_detection(img, query_img, score_threshold, nms_threshold):
|
| 20 |
target_sizes = torch.Tensor([img.size[::-1]])
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
inputs = processor(query_images=query_img, images=img, return_tensors="pt").to(device)
|
|
|
|
|
|
|
| 22 |
|
| 23 |
with torch.no_grad():
|
| 24 |
outputs = model.image_guided_detection(**inputs)
|
| 25 |
|
| 26 |
outputs.logits = outputs.logits.cpu()
|
| 27 |
outputs.pred_boxes = outputs.target_pred_boxes.cpu()
|
| 28 |
+
|
| 29 |
results = processor.post_process_image_guided_detection(
|
| 30 |
outputs=outputs,
|
| 31 |
threshold=score_threshold,
|
|
|
|
| 76 |
]
|
| 77 |
)
|
| 78 |
|
| 79 |
+
demo.launch()
|