docs/en/guides/streamlit-live-inference.md
Streamlit makes it simple to build and deploy interactive web applications. Combining this with Ultralytics YOLO26 allows for real-time object detection and analysis directly in your browser. YOLO26's high accuracy and speed ensure seamless performance for live video streams, making it ideal for applications in security, retail, and beyond.
<p align="center"> <iframe loading="lazy" width="720" height="405" src="https://www.youtube.com/embed/Fm72tfuQG70" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen> </iframe><strong>Watch:</strong> How to Build a Live Inference App with Ultralytics YOLO26 & Streamlit | Detection & Segmentation 🚀
</p>| Aquaculture | Animal Husbandry |
|---|---|
| Fish Detection using Ultralytics YOLO26 | Animals Detection using Ultralytics YOLO26 |
!!! tip "Ultralytics Installation"
Before you start building the application, ensure you have the Ultralytics Python package installed.
```bash
pip install ultralytics
```
!!! example "Inference using Streamlit with Ultralytics YOLO"
=== "CLI"
```bash
yolo solutions inference
yolo solutions inference model="path/to/model.pt"
```
These commands launch the default Streamlit interface that ships with Ultralytics. Use `yolo solutions inference --help` to view additional flags such as `source`, `conf`, or `persist` if you want to customize the experience without editing Python code.
=== "Python"
```python
from ultralytics import solutions
inf = solutions.Inference(
model="yolo26n.pt", # you can use any model that Ultralytics supports, e.g., YOLO26, or a custom-trained model
)
inf.inference()
# Make sure to run the file using command `streamlit run path/to/file.py`
```
This will launch the Streamlit application in your default web browser. You will see the main title, subtitle, and the sidebar with configuration options. Select your desired YOLO26 model, set the confidence and NMS thresholds, and click the "Start" button to begin the real-time object detection.
Under the hood, the Streamlit application uses the Ultralytics solutions module to create an interactive interface. When you start the inference, the application:
The application provides a clean, user-friendly interface with controls to adjust model parameters and start/stop inference at any time.
By following this guide, you have successfully created a real-time object detection application using Streamlit and Ultralytics YOLO26. This application allows you to experience the power of YOLO26 in detecting objects through your webcam, with a user-friendly interface and the ability to stop the video stream at any time.
For further enhancements, you can explore adding more features such as recording the video stream, saving the annotated frames, or integrating with other computer vision libraries.
Engage with the community to learn more, troubleshoot issues, and share your projects:
Setting up a real-time object detection application with Streamlit and Ultralytics YOLO26 is straightforward. First, ensure you have the Ultralytics Python package installed using:
pip install ultralytics
Then, you can create a basic Streamlit application to run live inference:
!!! example "Streamlit Application"
=== "Python"
```python
from ultralytics import solutions
inf = solutions.Inference(
model="yolo26n.pt", # you can use any model that Ultralytics supports, e.g., YOLO26, YOLOv10
)
inf.inference()
# Make sure to run the file using command `streamlit run path/to/file.py`
```
=== "CLI"
```bash
yolo solutions inference
```
For more details on the practical setup, refer to the Streamlit Application Code section of the documentation.
Using Ultralytics YOLO26 with Streamlit for real-time object detection offers several advantages:
Learn more about these benefits in the Advantages of Live Inference section.
After coding your Streamlit application integrating Ultralytics YOLO26, you can deploy it by running:
streamlit run path/to/file.py
This command will launch the application in your default web browser, enabling you to select YOLO26 models, set confidence and NMS thresholds, and start real-time object detection with a simple click. For a detailed guide, refer to the Streamlit Application Code section.
Real-time object detection using Streamlit and Ultralytics YOLO26 can be applied in various sectors:
For more in-depth use cases and examples, explore Ultralytics Solutions.
Ultralytics YOLO26 provides several enhancements over prior models like YOLOv5 and RCNNs:
For a comprehensive comparison, check Ultralytics YOLO26 Documentation and related blog posts discussing model performance.