Gradio

Open-source Python library for building web UIs and demos around machine learning models, APIs or any Python function.

Ask your AI about this, with this page as the source:ChatGPT ↗Claude ↗Perplexity ↗

Gradio is a Python library for putting a web interface in front of a function, most often a machine learning model, without writing frontend code. Hugging Face acquired it in 2021, and Hugging Face Spaces is the hosting its docs point to first.

How it works: you hand Gradio a Python function plus input and output components, and it builds the page. gr.Interface does that for a single function, gr.ChatInterface builds a chatbot UI around a chat function, and gr.Blocks gives you custom layouts, multiple data flows and event listeners when one function isn't enough. demo.launch() starts a local server.

What you get: every app also exposes an API, with a "Use via API" page and official Python and JavaScript clients; mcp_server=True turns those endpoints into MCP tools for LLMs. A built-in queue streams progress over Server-Sent Events. share=True creates a temporary public link that expires after a week, and you can deploy to Hugging Face Spaces, embed an app with a web component or iframe, or mount it inside a FastAPI app with gr.mount_gradio_app. Password auth and Hugging Face OAuth are built in.

The limits: styling goes through themes, css= and js=, but Gradio warns that query selectors in custom CSS and JS aren't guaranteed to keep working across versions because the DOM can change. The queue runs one worker per event by default, so concurrency for heavy functions is something you tune. And despite "free" in Gradio's own docs, Hugging Face's Spaces docs now say Gradio Spaces need a paid plan, apart from up to two ZeroGPU Spaces on a free personal account.

Where it fits

How Gradio itself is built

5 tools, from its own code, website and Product Hunt page.

Who uses it

1 makers' products, each linked to the source that shows it, and 62 open-source projects that declare it in their code.

The maker says so 1Declared in code 62How evidence is collected →
self-llm《开源大模型食用指南》针对中国宝宝量身打造的基于Linux环境快速微调(全参数/Lora)、部署国内外开源大模型(LLM)/多模态大模型(MLLM)教程Frontend FrameworkIn its code · source ↗

Open source: a project that declares Gradio as a dependency in its public code — verifiable, but not necessarily a live product.

Alternatives to Gradio

All alternatives by situation →

Questions makers ask about Gradio

What's the difference between Interface, ChatInterface and Blocks?

gr.Interface wraps one function with its inputs and outputs, gr.ChatInterface is built specifically for chatbot UIs, and gr.Blocks is the lower-level API for custom layouts and data flows. source ↗

How do I share an app?

share=True creates a public link through Gradio's proxy that expires after one week; for permanent hosting, deploy to Hugging Face Spaces with gradio deploy. source ↗

Is hosting on Hugging Face Spaces free?

Hugging Face's docs say Gradio and Docker Spaces require a paid plan (PRO for personal accounts), but a free personal account can host up to two Gradio Spaces on ZeroGPU. Free hardware sleeps when unused. source ↗

Can other code call my app as an API?

Yes. Each app has a "Use via API" page listing its endpoints, and official Python and JavaScript clients can call them. source ↗

Can I add login or put it inside an existing backend?

Yes. launch(auth=...) adds password auth, gr.LoginButton adds Hugging Face OAuth on Spaces, and gr.mount_gradio_app mounts the app inside a FastAPI app, where an auth_dependency can use other OAuth providers. source ↗

Can it act as an MCP server?

Yes. Install gradio[mcp] and launch with mcp_server=True; each API endpoint becomes an MCP tool described by its function's docstring and type hints. source ↗

Is Gradio free?

Yes — it is free, open-source software.

Is Gradio open source or self-hostable?

Open source, and you can self-host it. source ↗

Can AI coding agents work with Gradio?

No llms.txt, official MCP server or CLI found yet.

Who uses Gradio?

1 makers' products we track, each with a source, and 62 open-source projects declare it in their code. source ↗