Update app.py
Browse files
app.py
CHANGED
|
@@ -84,7 +84,7 @@ def detect_and_crop(image: Image.Image, object_name: str) -> Image.Image:
|
|
| 84 |
with torch.no_grad():
|
| 85 |
outputs = model_gnd(**inputs)
|
| 86 |
results = processor_gnd.post_process_grounded_object_detection(
|
| 87 |
-
outputs, inputs.input_ids,
|
| 88 |
)
|
| 89 |
if not results or len(results[0]['boxes']) == 0:
|
| 90 |
print(" [Detect & Crop] ⚠ Warning: Grounding DINO did not detect the object. Using full image.")
|
|
|
|
| 84 |
with torch.no_grad():
|
| 85 |
outputs = model_gnd(**inputs)
|
| 86 |
results = processor_gnd.post_process_grounded_object_detection(
|
| 87 |
+
outputs, inputs.input_ids, threshold=0.4, text_threshold=0.3, target_sizes=[(height, width)]
|
| 88 |
)
|
| 89 |
if not results or len(results[0]['boxes']) == 0:
|
| 90 |
print(" [Detect & Crop] ⚠ Warning: Grounding DINO did not detect the object. Using full image.")
|