Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -49,7 +49,7 @@ def yolo_inference(input_type, image, video, model_id, conf_threshold, iou_thres
|
|
| 49 |
Returns:
|
| 50 |
tuple: A tuple containing two elements:
|
| 51 |
- PIL.Image.Image or None: The annotated image if `input_type` was "Image",
|
| 52 |
-
|
| 53 |
- str or None: The path to the annotated video file if `input_type` was "Video",
|
| 54 |
otherwise None.
|
| 55 |
"""
|
|
@@ -191,7 +191,9 @@ def yolo_inference_for_examples(image, model_id, conf_threshold, iou_threshold,
|
|
| 191 |
)
|
| 192 |
return annotated_image
|
| 193 |
|
| 194 |
-
|
|
|
|
|
|
|
| 195 |
gr.Markdown("# Yolo13: Object Detection")
|
| 196 |
gr.Markdown("Upload an image or video for inference using the latest YOLOv13 models.")
|
| 197 |
gr.Markdown("π **Note:** Better-trained models will be deployed as they become available.")
|
|
@@ -229,14 +231,14 @@ with gr.Blocks() as app:
|
|
| 229 |
],
|
| 230 |
value="yolov13n.pt",
|
| 231 |
)
|
| 232 |
-
conf_threshold = gr.Slider(minimum=0, maximum=1, value=0.
|
| 233 |
iou_threshold = gr.Slider(minimum=0, maximum=1, value=0.45, label="IoU Threshold")
|
| 234 |
max_detection = gr.Slider(minimum=1, maximum=300, step=1, value=300, label="Max Detection")
|
| 235 |
-
infer_button = gr.Button("Detect Objects")
|
| 236 |
with gr.Column():
|
| 237 |
output_image = gr.Image(type="pil", show_label=False, show_share_button=False, visible=True)
|
| 238 |
output_video = gr.Video(show_label=False, show_share_button=False, visible=False)
|
| 239 |
-
gr.DeepLinkButton()
|
| 240 |
|
| 241 |
input_type.change(
|
| 242 |
fn=update_visibility,
|
|
|
|
| 49 |
Returns:
|
| 50 |
tuple: A tuple containing two elements:
|
| 51 |
- PIL.Image.Image or None: The annotated image if `input_type` was "Image",
|
| 52 |
+
otherwise None.
|
| 53 |
- str or None: The path to the annotated video file if `input_type` was "Video",
|
| 54 |
otherwise None.
|
| 55 |
"""
|
|
|
|
| 191 |
)
|
| 192 |
return annotated_image
|
| 193 |
|
| 194 |
+
theme = gr.themes.Ocean(primary_hue="blue", secondary_hue="pink")
|
| 195 |
+
|
| 196 |
+
with gr.Blocks(theme=theme) as app:
|
| 197 |
gr.Markdown("# Yolo13: Object Detection")
|
| 198 |
gr.Markdown("Upload an image or video for inference using the latest YOLOv13 models.")
|
| 199 |
gr.Markdown("π **Note:** Better-trained models will be deployed as they become available.")
|
|
|
|
| 231 |
],
|
| 232 |
value="yolov13n.pt",
|
| 233 |
)
|
| 234 |
+
conf_threshold = gr.Slider(minimum=0, maximum=1, value=0.35, label="Confidence Threshold")
|
| 235 |
iou_threshold = gr.Slider(minimum=0, maximum=1, value=0.45, label="IoU Threshold")
|
| 236 |
max_detection = gr.Slider(minimum=1, maximum=300, step=1, value=300, label="Max Detection")
|
| 237 |
+
infer_button = gr.Button("Detect Objects", variant="primary")
|
| 238 |
with gr.Column():
|
| 239 |
output_image = gr.Image(type="pil", show_label=False, show_share_button=False, visible=True)
|
| 240 |
output_video = gr.Video(show_label=False, show_share_button=False, visible=False)
|
| 241 |
+
gr.DeepLinkButton(variant="primary")
|
| 242 |
|
| 243 |
input_type.change(
|
| 244 |
fn=update_visibility,
|