Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -54,18 +54,27 @@ def object_detection(image, confidence_threshold):
|
|
| 54 |
return result_image, detected_objects_text
|
| 55 |
|
| 56 |
# Define the Gradio interface
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 57 |
demo = gr.Interface(
|
| 58 |
-
object_detection,
|
| 59 |
-
[
|
| 60 |
-
|
| 61 |
-
gr.outputs.Image(label="Detected Objects"),
|
| 62 |
-
gr.outputs.Textbox(label="Detected Objects List"),
|
| 63 |
-
gr.inputs.Slider(minimum=0.0, maximum=1.0, default=0.5, label="Confidence Threshold")
|
| 64 |
-
],
|
| 65 |
title="Object Detection with DETR (ResNet-101)",
|
| 66 |
-
description="Upload an image and
|
| 67 |
)
|
| 68 |
|
|
|
|
| 69 |
# Launch the Gradio interface
|
| 70 |
if __name__ == "__main__":
|
| 71 |
demo.launch()
|
|
|
|
| 54 |
return result_image, detected_objects_text
|
| 55 |
|
| 56 |
# Define the Gradio interface
|
| 57 |
+
# demo = gr.Interface(
|
| 58 |
+
# object_detection,
|
| 59 |
+
# [
|
| 60 |
+
# gr.inputs.Image(label="Upload an Image"),
|
| 61 |
+
# gr.outputs.Image(label="Detected Objects"),
|
| 62 |
+
# gr.outputs.Textbox(label="Detected Objects List"),
|
| 63 |
+
# gr.inputs.Slider(minimum=0.0, maximum=1.0, default=0.5, label="Confidence Threshold")
|
| 64 |
+
# ],
|
| 65 |
+
# title="Object Detection with DETR (ResNet-101)",
|
| 66 |
+
# description="Upload an image and adjust the confidence threshold to view detected objects."
|
| 67 |
+
# )
|
| 68 |
+
|
| 69 |
demo = gr.Interface(
|
| 70 |
+
fn=object_detection,
|
| 71 |
+
inputs=[gr.Image(label="Upload an Image"),gr.Slider(minimum=0.0, maximum=1.0, default=0.5, label="Confidence Threshold")],
|
| 72 |
+
outputs=[gr.Image(label="Detected Objects"),gr.Textbox(label="Detected Objects List")],
|
|
|
|
|
|
|
|
|
|
|
|
|
| 73 |
title="Object Detection with DETR (ResNet-101)",
|
| 74 |
+
description="Upload an image and get object detection results using the DETR model with a ResNet-101 backbone.",
|
| 75 |
)
|
| 76 |
|
| 77 |
+
|
| 78 |
# Launch the Gradio interface
|
| 79 |
if __name__ == "__main__":
|
| 80 |
demo.launch()
|