Spaces:
Build error
Build error
Update theme, header
Browse files
app.py
CHANGED
|
@@ -300,23 +300,23 @@ def create_video_inputs() -> List[gr.components.Component]:
|
|
| 300 |
]
|
| 301 |
|
| 302 |
|
| 303 |
-
def create_button_row(
|
| 304 |
-
prefix = "Image" if is_image else "Video"
|
| 305 |
return [
|
| 306 |
gr.Button(
|
| 307 |
-
f"
|
| 308 |
),
|
| 309 |
-
gr.Button(f"
|
| 310 |
]
|
| 311 |
|
| 312 |
|
| 313 |
# Gradio interface
|
| 314 |
-
with gr.Blocks(theme=gr.themes.
|
| 315 |
gr.Markdown(
|
| 316 |
"""
|
| 317 |
-
#
|
| 318 |
-
Experience state-of-the-art object detection with USTC's
|
| 319 |
-
|
|
|
|
| 320 |
""",
|
| 321 |
elem_classes="header-text",
|
| 322 |
)
|
|
@@ -333,9 +333,7 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
|
| 333 |
image_model_checkpoint,
|
| 334 |
image_confidence_threshold,
|
| 335 |
) = create_image_inputs()
|
| 336 |
-
image_detect_button, image_clear_button = create_button_row(
|
| 337 |
-
is_image=True
|
| 338 |
-
)
|
| 339 |
with gr.Column(scale=2):
|
| 340 |
image_output = gr.AnnotatedImage(
|
| 341 |
label="Detection Results",
|
|
@@ -374,12 +372,8 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
|
| 374 |
with gr.Row():
|
| 375 |
with gr.Column(scale=1, min_width=300):
|
| 376 |
with gr.Group():
|
| 377 |
-
video_input, video_checkpoint, video_confidence_threshold = (
|
| 378 |
-
|
| 379 |
-
)
|
| 380 |
-
video_detect_button, video_clear_button = create_button_row(
|
| 381 |
-
is_image=False
|
| 382 |
-
)
|
| 383 |
with gr.Column(scale=2):
|
| 384 |
video_output = gr.Video(
|
| 385 |
label="Detection Results",
|
|
|
|
| 300 |
]
|
| 301 |
|
| 302 |
|
| 303 |
+
def create_button_row() -> List[gr.Button]:
|
|
|
|
| 304 |
return [
|
| 305 |
gr.Button(
|
| 306 |
+
f"Detect Objects", variant="primary", elem_classes="action-button"
|
| 307 |
),
|
| 308 |
+
gr.Button(f"Clear", variant="secondary", elem_classes="action-button"),
|
| 309 |
]
|
| 310 |
|
| 311 |
|
| 312 |
# Gradio interface
|
| 313 |
+
with gr.Blocks(theme=gr.themes.Ocean()) as demo:
|
| 314 |
gr.Markdown(
|
| 315 |
"""
|
| 316 |
+
# Object Detection Demo
|
| 317 |
+
Experience state-of-the-art object detection with USTC's D-Fine models.
|
| 318 |
+
- **Image** and **Video** modes are supported.
|
| 319 |
+
- Select a model and adjust the confidence threshold to see detections!
|
| 320 |
""",
|
| 321 |
elem_classes="header-text",
|
| 322 |
)
|
|
|
|
| 333 |
image_model_checkpoint,
|
| 334 |
image_confidence_threshold,
|
| 335 |
) = create_image_inputs()
|
| 336 |
+
image_detect_button, image_clear_button = create_button_row()
|
|
|
|
|
|
|
| 337 |
with gr.Column(scale=2):
|
| 338 |
image_output = gr.AnnotatedImage(
|
| 339 |
label="Detection Results",
|
|
|
|
| 372 |
with gr.Row():
|
| 373 |
with gr.Column(scale=1, min_width=300):
|
| 374 |
with gr.Group():
|
| 375 |
+
video_input, video_checkpoint, video_confidence_threshold = create_video_inputs()
|
| 376 |
+
video_detect_button, video_clear_button = create_button_row()
|
|
|
|
|
|
|
|
|
|
|
|
|
| 377 |
with gr.Column(scale=2):
|
| 378 |
video_output = gr.Video(
|
| 379 |
label="Detection Results",
|