Update app.py
Browse files
app.py
CHANGED
|
@@ -32,9 +32,7 @@ except Exception as e:
|
|
| 32 |
|
| 33 |
@spaces.GPU
|
| 34 |
def detect_objects(image):
|
| 35 |
-
|
| 36 |
-
Detect objects in an image using DETR model
|
| 37 |
-
"""
|
| 38 |
if model is None or processor is None:
|
| 39 |
return image, "Model failed to load. Please check logs."
|
| 40 |
|
|
@@ -98,6 +96,7 @@ def scan_edges(image):
|
|
| 98 |
# Apply Gaussian blur
|
| 99 |
blurred = cv2.GaussianBlur(gray, (5, 5), 0)
|
| 100 |
|
|
|
|
| 101 |
# Edge detection using Canny
|
| 102 |
edges = cv2.Canny(blurred, 50, 150)
|
| 103 |
|
|
@@ -137,7 +136,7 @@ with gr.Blocks(title="Object Scanner") as demo:
|
|
| 137 |
value="Object Detection",
|
| 138 |
label="Scanning Mode"
|
| 139 |
)
|
| 140 |
-
scan_btn = gr.Button("
|
| 141 |
|
| 142 |
with gr.Column():
|
| 143 |
output_image = gr.Image(type="numpy", label="Processed Result")
|
|
|
|
| 32 |
|
| 33 |
@spaces.GPU
|
| 34 |
def detect_objects(image):
|
| 35 |
+
|
|
|
|
|
|
|
| 36 |
if model is None or processor is None:
|
| 37 |
return image, "Model failed to load. Please check logs."
|
| 38 |
|
|
|
|
| 96 |
# Apply Gaussian blur
|
| 97 |
blurred = cv2.GaussianBlur(gray, (5, 5), 0)
|
| 98 |
|
| 99 |
+
|
| 100 |
# Edge detection using Canny
|
| 101 |
edges = cv2.Canny(blurred, 50, 150)
|
| 102 |
|
|
|
|
| 136 |
value="Object Detection",
|
| 137 |
label="Scanning Mode"
|
| 138 |
)
|
| 139 |
+
scan_btn = gr.Button(" Process Image", variant="primary")
|
| 140 |
|
| 141 |
with gr.Column():
|
| 142 |
output_image = gr.Image(type="numpy", label="Processed Result")
|