Enhanced YOLOv11 SAHI Demo with Dynamic Model Loading, UI Controls and MCP Compatibility

#5

This pull request introduces several significant enhancements to the SAHI + YOLOv11 Gradio demonstration. Key changes include:

  • Dynamic Model Selection: Added a dropdown menu allowing users to select between various YOLOv11 models (yolo11n.pt, yolo11s.pt, yolo11m.pt, yolo11l.pt, yolo11x.pt), enabling flexible experimentation with different model scales.
  • Intuitive UI Controls: Converted confidence_threshold, overlap_width_ratio, overlap_height_ratio, and postprocess_match_threshold from numerical inputs to user-friendly sliders, improving interactive control.
  • Max Detections Control: Introduced a new slider for max_detections, allowing users to limit the number of displayed bounding box predictions for both standard and sliced inference.
  • Code Refactoring and Robustness:
    • Transitioned the Gradio interface from gr.Interface to gr.Blocks for more structured UI management.
    • Implemented a dedicated load_yolo_model function to handle dynamic model loading, centralizing model initialization.
    • Added Google-style docstrings to load_yolo_model and sahi_yolo_inference for enhanced code readability and maintainability.
  • MCP Compatibility: Configured the application launch with mcp_server=True for seamless integration into Multi-Container Pod (MCP) environments.

Hi @fcakyon , Since your current environment does not have access to a dedicated GPU, consider exploring ZeroGPU as a potential resource. They offer free GPU access that could accelerate your model inference tasks significantly.

wow thanks for the fantastic pr! @atalaydenknalbant

fcakyon changed pull request status to merged

enabled zeroGPU for space, tried to implement support in this commit: https://huggingface.co/spaces/fcakyon/sahi-yolo11/commit/a203767664a31937032eba7138630aa178d235b5

Sign up or log in to comment