Update app.py
Browse files
app.py
CHANGED
@@ -83,6 +83,15 @@ with gr.Blocks() as demo:
|
|
83 |
with gr.Column():
|
84 |
output_img = gr.Image(label="Detection Result", interactive=False)
|
85 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
86 |
# Define button actions
|
87 |
clear.click(gradio_reset, inputs=None, outputs=[input_img, output_img])
|
88 |
predict.click(detect_objects, inputs=[input_img], outputs=[output_img])
|
|
|
83 |
with gr.Column():
|
84 |
output_img = gr.Image(label="Detection Result", interactive=False)
|
85 |
|
86 |
+
# Add Examples section with images from the root directory
|
87 |
+
with gr.Accordion("Select an Example Image"):
|
88 |
+
example_root = os.path.dirname(__file__) # Root directory
|
89 |
+
example_images = [os.path.join(example_root, file) for file in os.listdir(example_root) if file.endswith(".jpg")]
|
90 |
+
gr.Examples(
|
91 |
+
examples=example_images,
|
92 |
+
inputs=[input_img],
|
93 |
+
)
|
94 |
+
|
95 |
# Define button actions
|
96 |
clear.click(gradio_reset, inputs=None, outputs=[input_img, output_img])
|
97 |
predict.click(detect_objects, inputs=[input_img], outputs=[output_img])
|