fastrtc icon indicating copy to clipboard operation
fastrtc copied to clipboard

Error: "Too many concurrent users. Come back later!" in gradio-webrtc on mobile

Open rybakov-ks opened this issue 1 month ago • 7 comments

I'm using gradio-webrtc on my mobile phone, and I encountered an issue where after starting a recording, stopping it, and then starting another one, I receive the error message: Too many concurrent users. Come back later! This error appears frequently, even though I'm the only one using the app. Expected behavior: I should be able to start a new recording without encountering the error. To fix the error, need to restart the application.

import gradio as gr
from gradio_webrtc import WebRTC
from ultralytics import YOLO

model = YOLO("yolo11n.pt")

def detection(image, conf_threshold=0.3):
    results = model(image, conf=conf_threshold)
    im_bgr = results[0].plot()
    return im_bgr

css = """
#app-container {
    max-width: 700px;
    margin: 0 auto;
}

#author-note {
    text-align: right;
    font-size: 14px;
}
"""

demo = gr.Blocks(theme='snehilsanyal/scikit-learn', title='Detection', css=css, analytics_enabled=False) #reilnuud/polite, xiaobaiyuan/theme_brief, snehilsanyal/scikit-learn, seafoam

with demo:
    with gr.Column(elem_id="app-container"):
        #gr.Markdown("Разработал Рыбаков К.С.", elem_id="author-note")
        image = WebRTC(label="Stream", height=600)
        conf_threshold = gr.Slider(
            label="Confidence Threshold",
            minimum=0.0,
            maximum=1.0,
            step=0.05,
            value=0.30,
        )

    image.stream(
        fn=detection, inputs=[image, conf_threshold], outputs=[image]
    )

demo.queue(default_concurrency_limit=100).launch(server_name="127.0.0.1", server_port=5007)

rybakov-ks avatar Jan 28 '25 10:01 rybakov-ks