Spaces:
Runtime error
Runtime error
remove hardcoding
Browse files
app.py
CHANGED
@@ -47,7 +47,7 @@ import numpy as np
|
|
47 |
from PIL import Image
|
48 |
|
49 |
@weave.op()
|
50 |
-
def
|
51 |
"""
|
52 |
Detects a brain tumor in the given image and returns the annotated image.
|
53 |
|
@@ -61,7 +61,7 @@ def detect_brain_tumor_owlv2(image, seg_input, debug: bool = True):
|
|
61 |
"""
|
62 |
|
63 |
# Step 2: Detect brain tumor using owl_v2
|
64 |
-
prompt =
|
65 |
detections = owl_v2(prompt, image)
|
66 |
|
67 |
# Step 3: Overlay bounding boxes on the image
|
@@ -86,7 +86,7 @@ def detect_brain_tumor_owlv2(image, seg_input, debug: bool = True):
|
|
86 |
return (image_with_bboxes, annotations)
|
87 |
|
88 |
@weave.op()
|
89 |
-
def
|
90 |
"""
|
91 |
Detects a brain tumor in the given image and returns the annotated image.
|
92 |
|
@@ -100,7 +100,7 @@ def detect_brain_tumor_dino(image, seg_input, debug: bool = True):
|
|
100 |
"""
|
101 |
|
102 |
# Step 2: Detect brain tumor using grounding_dino
|
103 |
-
prompt =
|
104 |
detections = grounding_dino(prompt, image)
|
105 |
|
106 |
# Step 3: Overlay bounding boxes on the image
|
@@ -125,7 +125,7 @@ def detect_brain_tumor_dino(image, seg_input, debug: bool = True):
|
|
125 |
return (image_with_bboxes, annotations)
|
126 |
|
127 |
@weave.op()
|
128 |
-
def
|
129 |
"""
|
130 |
Detects a brain tumor in the given image and returns the annotated image.
|
131 |
|
|
|
47 |
from PIL import Image
|
48 |
|
49 |
@weave.op()
|
50 |
+
def detect_object_owlv2(image, seg_input, debug: bool = True):
|
51 |
"""
|
52 |
Detects a brain tumor in the given image and returns the annotated image.
|
53 |
|
|
|
61 |
"""
|
62 |
|
63 |
# Step 2: Detect brain tumor using owl_v2
|
64 |
+
prompt = seg_input
|
65 |
detections = owl_v2(prompt, image)
|
66 |
|
67 |
# Step 3: Overlay bounding boxes on the image
|
|
|
86 |
return (image_with_bboxes, annotations)
|
87 |
|
88 |
@weave.op()
|
89 |
+
def detect_object_dino(image, seg_input, debug: bool = True):
|
90 |
"""
|
91 |
Detects a brain tumor in the given image and returns the annotated image.
|
92 |
|
|
|
100 |
"""
|
101 |
|
102 |
# Step 2: Detect brain tumor using grounding_dino
|
103 |
+
prompt = seg_input
|
104 |
detections = grounding_dino(prompt, image)
|
105 |
|
106 |
# Step 3: Overlay bounding boxes on the image
|
|
|
125 |
return (image_with_bboxes, annotations)
|
126 |
|
127 |
@weave.op()
|
128 |
+
def detect_object_florence2(image, seg_input, debug: bool = True):
|
129 |
"""
|
130 |
Detects a brain tumor in the given image and returns the annotated image.
|
131 |
|