Streamlit-WebRTC
Build a complete real-time audio and video web app. Using only Python.
Streamlit turns a Python script into an interactive web app. Streamlit-WebRTC adds real-time camera and microphone streams to it: the component handles browser capture and WebRTC transport, and passes each frame to your Python code, where any library, such as a YOLO model, can process it. Everything lives in one script, with no frontend code.
❤️
Build real-time computer vision with one callback in ~20 lines of Python
import av
import streamlit as st
from streamlit_webrtc import webrtc_streamer
from ultralytics import YOLO
model_name = st.selectbox(
"YOLO model",
["yolo11n.pt", "yolo11s.pt", "yolov8n.pt"],
)
with st.spinner(f"Loading {model_name}..."):
model = YOLO(model_name)
def process(frame: av.VideoFrame) -> av.VideoFrame:
image = frame.to_ndarray(format="bgr24")
result = model(image, verbose=False)[0]
annotated = result.plot()
return av.VideoFrame.from_ndarray(
annotated, format="bgr24"
)
webrtc_streamer(
key="detection",
video_frame_callback=process,
media_stream_constraints={"video": True, "audio": False},
)
Start with a Streamlit app
- What is Streamlit?
A Python framework that turns a script into an interactive web app. Each
st.*call draws a UI element, with no frontend code.- Python script
streamlit run- Web app
- What is Streamlit-WebRTC?
A component that adds real-time camera and microphone streams to a Streamlit app and passes each frame to your Python code.
- Install
uv add streamlit streamlit-webrtc- Run
uv run streamlit run app.py
How Python reaches the browser in real time
Turn Python models into user-facing apps without adding a second language or implementing WebRTC. Streamlit-WebRTC provides three media roles: sinks consume input for Streamlit outputs, filters transform and return media, and sources generate media. Compose them independently for audio and video.
Build apps by composing video and audio inputs, processing, and outputs

Generate audio in Python
Create audio programmatically and publish it as a live track.
Yuichiro@whitphx · Jun 2025
Emotion-based music recommendation
Read face and hand landmarks, classify emotion, and recommend music.
Pavankumar Mhaske@P1kumarMhaske · May 2024
StreamDiffusion camera
Transform a live camera feed with StreamDiffusion and TensorRT.
Naoto Nakai@NuCode · Dec 2023
Voice conversation with ChatGPT
Transcribe microphone input and generate emotion-aware responses.
Naoto Nakai@NuCode · Mar 2023
Turn paper molecular models into 3D
Recognize a paper model, then show its 3D form and chemical properties.
Nori Yamamoto@yamnor · Aug 2022
Guitar tuner
Estimate pitch from live microphone audio and show the closest note.
@gar@gerardbentley.com@GarsBar35Plus · Mar 2022
Real-time speech-to-text without an external API
Stream microphone audio to a local speech recognizer and update the transcript.
Yuichiro@whitphx · May 2021
Real-time eating-pace feedback
Detect bites from webcam landmarks and report pace and session statistics.
Aktham MomaniStreamlit Forum · Feb 2026
Multi-party video chat
Route peers separately or combine video into one view, with face filters before delivery.
Yuichiro TachibanaGitHub repository · Jul 2021