Streamlit vs Gradio
Streamlit vs Gradio compared for 2026: Streamlit 1.67.0 (script-rerun data apps with caching, session state and AppTest) vs Gradio 6.32.0 (event-driven ML demos with a built-in queue, auto-generated API clients and an MCP server). Includes install size, startup time, rerun behaviour, queue concurrency, API and MCP checks from runs we did on the same machine, hosting limits, plus a clear pick.
Quick Answer
Streamlit and Gradio both turn a Python file into a web app without writing HTML or JavaScript, and both are Apache-2.0 projects with about 45k GitHub stars. They work differently. Streamlit 1.67.0 reruns your whole script from top to bottom on every widget change, so you lean on st.cache_data, st.cache_resource, session state and fragments; it suits dashboards and internal data tools. Gradio 6.32.0 wires components to Python functions through event listeners, puts every event through a queue (one request at a time per listener by default), and exposes each named event as an API for its Python and JavaScript clients and, with one flag, as an MCP tool. In our runs Streamlit imported in about 0.3 s and served its health check in 0.4-0.9 s; Gradio imported in about 1.5 s and was ready in 1.7-3.8 s. Four simultaneous calls to a one-second Gradio function took 4.05 s by default and 1.05 s with concurrency_limit=4. Pick Streamlit for data apps and dashboards; pick Gradio for model demos, Hugging Face Spaces and anything that also needs an API or MCP endpoint.
Last updated November 26, 2026. Covers Streamlit 1.67.0 (5 November 2026) and Gradio 6.32.0 (12 November 2026) on Python 3.13; package metadata, release notes, docs and hosting pages read on 26 November 2026, plus same-machine install, startup, rerun, queue, API and MCP runs we did that day.
| Feature | Streamlit | Gradio |
|---|---|---|
| Licence & Repository | Apache-2.0; streamlit/streamlit, ~46.5k stars | Apache-2.0; gradio-app/gradio, ~44.2k stars |
| Latest Release (Nov 2026) | 1.67.0 on 5 Nov 2026 (monthly-ish releases) | 6.32.0 on 12 Nov 2026 (gradio-client 2.7.2 pinned) |
| Supported Python | 3.11+ | 3.10+ |
| Execution Model | Whole script reruns on every widget change; st.fragment for partial reruns | Event listeners call functions (gr.Interface or gr.Blocks) |
| Per-user State | st.session_state per browser session | gr.State per session; module globals shared by all users |
| Caching | st.cache_data / st.cache_resource (shared by default, scope='session' option) | No built-in result cache (add functools.lru_cache or your own) |
| Concurrency Control | Each session reruns the script independently; shared caches must be thread-safe | Queue per listener, concurrency_limit default 1, concurrency_id to share |
| Programmatic API | None for your functions; agent API (1.67.0) drives the app over HTTP | Auto API per named event; Python gradio_client and JS @gradio/client |
| MCP Server | Not built in | launch(mcp_server=True) with gradio[mcp]; Streamable HTTP at /gradio_api/mcp/ |
| Component Focus | Data apps: dataframes, editors, charts, maps, metrics | ML I/O: image, audio, video, chatbot, files, 3D, dataframes |
| Layout & Pages | Containers, sidebar, dialogs (st.dialog), fragments | Blocks with rows, columns, tabs; gradio.Server for a custom frontend |
| Testing | streamlit.testing.v1.AppTest (headless, pytest-friendly) | No dedicated harness; call functions directly or via gradio_client |
| Built-in Auth (documented) | Not covered in the docs we read | launch(auth=...) username/password; MCP requires login when auth is set (6.32.0) |
| Free Hosting Options | Streamlit Community Cloud (free); HF Spaces via Docker template | HF Spaces (paid plan for compute, ZeroGPU allowance on free accounts) |
| Temporary Public Link | None built in (deploy or tunnel) | share=True link via Gradio share servers, expires after 1 week |
| Server Stack | Starlette + Uvicorn + WebSockets (1.67.0 deps) | FastAPI + Starlette + Uvicorn |
| Our Run: install footprint | 34 packages, 362 MB (PyArrow 165 MB) | 53 packages, 254 MB (+14 packages for gradio[mcp]) |
| Our Run: import / ready time | Import 0.31-0.33 s; health check 0.40-0.90 s | Import 1.45-1.52 s; page ready 1.67-3.77 s |
| Our Run: changing an unrelated slider | 0.01 s with st.cache_data, 1.00-1.01 s without | No re-run (function fires only on its event) |
| Our Run: 4 parallel calls to a 1 s function | Not comparable (per-session reruns; not measured) | 4.05 s default (serial); 1.05 s with concurrency_limit=4 |
Streamlit
Streamlit is an open-source Python framework for building data apps and dashboards. You write a normal script that calls st.title, st.slider, st.dataframe or st.line_chart, run it with streamlit run app.py, and every widget interaction reruns the script from top to bottom with the new widget values. Caching decorators (st.cache_data for data, st.cache_resource for models and connections), st.session_state, fragments that rerun part of a page (since 1.37.0), and the AppTest testing framework are built around that model. Streamlit 1.67.0 was released on 5 November 2026, requires Python 3.11 or newer, is Apache-2.0 licensed, depends on Starlette, Uvicorn, pandas, PyArrow and Altair among others, and has about 46.5k GitHub stars. Apps deploy free to Streamlit Community Cloud from GitHub.
Pros
- The script-rerun model is easy to read: the app is the code top to bottom, with no callbacks to wire for simple dashboards
- Strong data widgets out of the box: dataframes, data editor, charts (Altair, Vega-Lite, pydeck maps, ECharts) and layout containers
- Built-in caching made our unrelated slider change take 0.01 s instead of re-running a one-second function
- AppTest runs the app headless in pytest, setting widget values and reading output without a browser
- Fast to start: about 0.3 s to import and 0.4-0.9 s to a healthy server in our run
- Free Community Cloud hosting straight from a GitHub repository (public or private)
Cons
- Every interaction reruns the whole script; without caching our slider change re-ran a one-second function each time
- Cached values are shared by all users by default, and st.cache_resource objects are shared and mutable, so thread-safety is your job
- No auto-generated API or MCP endpoint for your functions; 1.67.0 adds an agent API for driving apps over HTTP, but it is not a function API
- Heavy install: 34 packages and 362 MB, 165 MB of it PyArrow, which matters for small containers
- Community Cloud limits are modest (about 2.7 GB memory maximum as of the documented February 2024 figures) and apps sleep after 12 hours without traffic; Hugging Face has deprecated its Streamlit SDK in favour of a Docker template
Best For
Internal dashboards, data exploration tools, analytics apps and prototypes where the data team writes Python and the app is mostly widgets around dataframes and charts.
Gradio
Gradio is an open-source Python library for building demos and web apps around machine-learning models and other Python functions. You either wrap a function with gr.Interface or lay out components in gr.Blocks and connect them with event listeners such as button.click(fn, inputs, outputs). Every event goes through a built-in queue, every named event becomes an API endpoint usable from the gradio_client Python package or the @gradio/client JavaScript package, launch(share=True) creates a temporary public link, and launch(mcp_server=True) with the mcp extra exposes your functions as MCP tools. Gradio is the native SDK of Hugging Face Spaces. Gradio 6.32.0 was released on 12 November 2026, requires Python 3.10 or newer, is Apache-2.0 licensed, runs on FastAPI, Starlette and Uvicorn, and has about 44.2k GitHub stars.
Pros
- Functions run only when their event fires; changing an unrelated input does not re-execute anything
- Every named event is an API: gradio_client listed our /run endpoint with typed parameters and called it in 1.02 s
- One-flag MCP server: launch(mcp_server=True) served a Streamable HTTP endpoint that answered an MCP initialize call and listed our function as a tool
- Built-in queue with concurrency_limit and concurrency_id, which protects GPUs and rate-limited backends by default
- Rich media components for ML (image, audio, video, chat, 3D) and launch(share=True) links that last a week
- Native SDK on Hugging Face Spaces, with ZeroGPU available to free personal accounts for up to two Gradio Spaces
Cons
- The default concurrency limit of 1 per listener serialises users: our four parallel calls took 4.05 s until we set concurrency_limit=4
- Module-level Python state is shared by all users; our call counter interleaved across four clients, so per-user data needs gr.State
- Slower to start: about 1.5 s to import and 1.7-3.8 s until the page answered, with about 150-165 MB RSS at idle
- No built-in result cache comparable to st.cache_data; you add functools.lru_cache or your own
- On Hugging Face, creating Gradio or Docker Spaces on compute needs a paid plan (PRO, Team or Enterprise) except the ZeroGPU allowance
Best For
Model demos, chat and media apps, Hugging Face Spaces, and Python functions that need a web UI, a client API and an MCP endpoint from the same code.
Script reruns versus event listeners
The two libraries start from opposite execution models, and almost every practical difference follows from that. A Streamlit app is a script. When a user moves a slider, Streamlit reruns the whole file with the new value, and the page is rebuilt from what the script emits; the docs describe reruns as a central part of every app and offer st.fragment (since 1.37.0) to rerun only part of a page. A Gradio app is a set of components plus event listeners: btn.click(run, [text, n], out) means run is called with the current values of text and n when the button is clicked, and nothing else executes. We built the same 'upper-case some text, repeat it n times' app in both, with a one-second sleep standing in for a model call. In Streamlit, measured with AppTest on 26 November 2026, the first run took 1.07-1.09 s; changing the repeat slider then took 0.01 s with st.cache_data on the slow function and 1.00-1.01 s without it, and a session-state counter showed the script ran on every interaction. In Gradio the function ran only when the event fired (1.02 s per call through gradio_client). So Streamlit asks you to think about what must be cached; Gradio asks you to think about which events call which functions.
What we measured: install, startup and memory
We installed each into its own Python 3.13.18 virtual environment with uv and no cache, in the cloud sandbox with 2 vCPUs. Streamlit 1.67.0 pulled 34 packages and 362 MB of site-packages, of which PyArrow alone is 165 MB, pandas 45 MB and Streamlit 33 MB. Gradio 6.32.0 pulled 53 packages and 254 MB, led by Gradio itself at 80 MB, pandas and NumPy; adding the mcp extra installed 14 more packages. Both resolved in under two seconds. Importing the library took 0.31-0.33 s for Streamlit and 1.45-1.52 s for Gradio across three runs. From launch to a successful HTTP response, streamlit run reached /_stcore/health in 0.40-0.90 s, and the Gradio script answered on / in 1.67-1.81 s, or 3.77 s on the very first, cold run. Resident memory a few seconds after startup was about 62-67 MB for Streamlit and 151-165 MB for Gradio. The Streamlit figure is before any browser session connects, because Streamlit only executes your script when a session starts, so a real app's memory depends on what your script loads. Both now sit on Starlette and Uvicorn: they are dependencies of Streamlit 1.67.0, Tornado was not in our environment, and Gradio runs on FastAPI.
Concurrency, state and caching across users
Gradio's queue is explicit. Its docs say each event listener has its own queue processing one request at a time unless you set concurrency_limit, share a queue between listeners with concurrency_id, or change default_concurrency_limit in Blocks.queue(). We fired four simultaneous gradio_client calls at the one-second function: they took 4.05 s with the default and 1.05 s with concurrency_limit=4. That default is a sensible guard for a single GPU and a trap for an I/O-bound function that could serve everyone at once. The same test exposed the state rule: a module-level call counter was shared by all four clients and their results interleaved (calls 2, 3, 5, 4), so per-user values belong in gr.State. Streamlit separates users by session. st.session_state is per browser session, but the caches are not: the docs state that cached values are available to all users by default unless you pass scope='session', and that st.cache_resource returns the same object to every session, so mutations must be thread-safe. 1.67.0 added a per-function max_size for st.cache_data and a server-wide maxCacheDataSize budget. We did not load-test concurrent Streamlit sessions, because doing it properly needs browser sessions over WebSockets, so we make no throughput claim for it.
APIs, MCP, testing and hosting
Gradio treats the UI as one client among several. view_api() on our app listed a /run endpoint with a string text parameter and a numeric n, both with defaults, and /gradio_api/info returned the same schema as JSON. With gradio[mcp] installed, launch(mcp_server=True) printed a Streamable HTTP URL at /gradio_api/mcp/; the schema endpoint listed run as a tool, and a JSON-RPC initialize call returned protocol version 2025-06-18. Its description was empty because our function had no docstring, so write docstrings if agents will call your tools. 6.32.0 also makes the MCP server require login when the app uses auth. Streamlit has no function API; 1.67.0 adds an agent API that lets agents drive the app over HTTP, which we read about but did not test. For testing, Streamlit's AppTest is the clear win: it ran our app headless, set widget values and read the output. Gradio has no equivalent harness. For hosting, Streamlit Community Cloud is free from GitHub, with documented limits of up to 2 CPU cores, 2.7 GB memory and 50 GB storage (as of February 2024) and sleep after 12 hours idle. Hugging Face Spaces is Gradio's home: CPU Basic (2 vCPU, 16 GB) has no hourly cost, but creating Gradio or Docker Spaces requires a paid plan except up to two ZeroGPU Gradio Spaces on free accounts, and its Streamlit SDK is deprecated in favour of Docker.
Limits and when not to use each
Do not choose Streamlit when the app is really an API with a face: there is no generated endpoint for your functions, so other services or agents would have to drive the UI. Avoid it for apps with lots of independent interactive regions unless you are ready to structure them with fragments and caching, because every unscoped interaction reruns everything. Watch the container size, too: PyArrow alone was 165 MB in our install. Do not choose Gradio for a classic BI-style dashboard with many filters, tables and charts that should update together; Streamlit's widget set and rerun model fit that better, and Gradio's event wiring gets verbose. Do not deploy Gradio for many users without setting concurrency limits and moving per-user data into gr.State. Its share=True links are for demos, not production: they go through Gradio's share servers and expire after a week, though you can host your own share server. Both are free and Apache-2.0 licensed; the costs are in hosting. One caveat on our numbers: we tried to measure fragment reruns with AppTest, but AppTest reran the full script, so we do not quote a fragment timing. Switching later is a rewrite of the UI layer in either direction, so keep model and data code in plain Python modules that both could import.
Verdict
Pick Streamlit for dashboards, data exploration and internal tools. The top-to-bottom script is the simplest mental model for data people, its dataframe and chart widgets are the stronger set, AppTest gives you real tests, and it started several times faster than Gradio in our run. Budget for caching from day one: an uncached slow call reruns on every widget change, and the default cache is shared across users. Pick Gradio for model demos, chat and media apps, and any app that should also be callable by code or by AI agents. Its event model never reruns unrelated code, every named event is an API for its Python and JavaScript clients, and launch(mcp_server=True) turned our function into an MCP tool with no extra code. Set concurrency_limit deliberately, because the default of 1 per listener queued our four users one after another, and keep per-user data in gr.State rather than module globals. For hosting, Streamlit Community Cloud is free from GitHub; on Hugging Face, Gradio is the native SDK but compute Spaces need a paid plan beyond the ZeroGPU allowance, and Streamlit runs there only through the Docker template.