Gradio
Build Gradio web UIs and demos in Python. Use when creating or editing Gradio apps, components, event listeners, layouts, or chatbots.
- Type
- Skill
- Repository
- huggingface/skills
- GitHub stars
- 11.1k
- License
- Apache-2.0
- Repo last updated
- Sep 25, 2026
- Source file
- skills/huggingface-spaces/references/gradio.md
What Gradio is
Gradio is a skill published in the huggingface/skills repository on GitHub, which has about 11.1k stars. The repository describes itself as: “Give your agents the power of the Hugging Face ecosystem”
A skill is a folder with a SKILL.md file: frontmatter with a name and a description, followed by instructions Claude follows. Claude loads a skill automatically when a task matches its description, and you can also run it directly with a slash and its name.
Skills work in Claude Code and in Claude Cowork, which makes Gradio a portable way to give Claude the same method everywhere.
How to install Gradio
Claude Code
- Download the references folder from the repository.
- Save it as ~/.claude/skills/<skill-name>/SKILL.md for all projects, or .claude/skills/<skill-name>/SKILL.md for one project.
- Claude loads it automatically when a task matches; you can also run it with / and its name.
Claude Cowork
- Zip the skill folder so SKILL.md sits at the top level of the folder.
- Open Customize → Skills, click +, then upload the ZIP.
- Start a task that matches the description, or call it by name with /.
New to extending Cowork? Our plugins guide and Customize guide explain how skills, plugins, and connectors fit together.
Inside the source file
An excerpt from skills/huggingface-spaces/references/gradio.md, shared under the repository's Apache-2.0 license. Read the full file on GitHub.
Patterns and quirks specific to running Gradio inside a Space. Assumes you're already comfortable with stock Gradio components and gr.Blocks / gr.Interface.
For deeper Gradio API guidance — components, layouts, event listeners, chatbots, the Gradio 5→6 migration — use the dedicated huggingface-gradio skill. Install it with hf skills add huggingface-gradio (add --claude --global to also install for Claude Code, user-level).
For ZeroGPU-specific decorator + worker semantics, see zerogpu.md.
Themes and layout
- Default theme preference: gr.themes.Citrus(). Alternatives: gr.themes.Soft() or no theme. Pick once and don't over-style.
- For apps that don't need full-width, constrain with CSS so they're readable on 4K displays:
CSS = """
#col-container { max-width: 1100px; margin: 0 auto; }
.dark .gradio-container { color: var(--body-text-color); }
"""
with gr.Blocks(theme=gr.themes.Citrus(), css=CSS) as demo: ...Always include the .dark .gradio-container override with gr.themes.Citrus() — without it Citrus's dark mode renders dark text on a dark background (text inherits unset colors). The same fix is harmless (and worth keeping) under other themes.
- Width-cap with !important if Gradio 6's own breakpoints fight you — target main, .gradio-container, and the inner fillable wrapper, otherwise the width caps but goes flush-left.
Minimal layout most demos converge to
with gr.Row():
prompt = gr.Textbox(show_label=False, placeholder="…", container=False, scale=4)
run = gr.Button("Run", variant="primary", scale=1)
output = gr.Image(...)
with gr.Accordion("Advanced settings", open=False):
...container=False on the inline Textbox removes the default outer border for a tighter look.
gr.Markdown for the intro
Be succinct. Title, one-line description, a links section. Don't over-explain how it works — that's what the model card is for.
gr.Examples
Add gr.Examples whenever it makes sense (the app takes user input and representative inputs exist). It's the first thing a visitor clicks and it doubles as an instant smoke test. Prefer examples that mirror the official examples from the original repo / model card — the prompts, images, and settings the authors showcase — over inventing your own.
Keep each example row to the few variables a user actually changes (the prompt, the input image). Give the handler default values for everything else (steps, guidance, seed, …) so an example row is ["a cat on a windowsill"], not a wall of knobs. Design the signature so the interesting inputs come first and the rest default:
@spaces.GPU(duration=60)
def generate(prompt, seed=42, steps=28, guidance=5.0): # only `prompt` varies in examples
...
gr.Examples(
examples=[
["a cat sitting on a windowsill"],
["mountains at sunset, photorealistic"],
],
inputs=[prompt], # just the varied inputs; the rest use the handler defaults
outputs=output,
fn=generate,
cache_examples=True,
cache_mode="lazy",
)Why these flags:
- cache_examples=True makes example clicks instant (no re-inference per visitor).
- cache_mode="lazy" — caches on first user click for each example. Required on ZeroGPU (Gradio's default on ZeroGPU is already lazy via GRADIO_CACHE_MODE=lazy). Eager would pre-run every example at app startup, but ZeroGPU has no GPU attached at startup — it'd fail and burn the creator's daily quota.
- cache_examples=True silently disables run_on_click / run_examples_on_click. If your app relies on click-only behavior, set cache_examples=False.
The cache key is the example row's file path, not a content hash. Regenerating an asset in place serves the stale cached output forever. If you replace example files, bump a cache_version marker or wipe .gradio/cached_examples/ /.
Before you install
- Read the whole file first. Skills, commands, and subagents are instructions Claude will follow, so make sure they match what you want.
- Check which tools, scripts, or MCP servers it uses. Local servers and scripts run with your permissions.
- Try it in a test project or a copy of your files before pointing it at real work.
- Pin the version you tested, and review changes before updating.
- Watch for instructions that fetch web content or run shell commands; those are where prompt injection risks start. See our prompt injection guide.
FAQ
What is Gradio?
Gradio is a skill for Claude Code and Claude Cowork from the huggingface/skills repository on GitHub. Build Gradio web UIs and demos in Python. Use when creating or editing Gradio apps, components, event listeners, layouts, or chatbots.
How do I install Gradio in Claude Code?
Download the references folder from the repository. Save it as ~/.claude/skills/<skill-name>/SKILL.md for all projects, or .claude/skills/<skill-name>/SKILL.md for one project. Claude loads it automatically when a task matches; you can also run it with / and its name.
Can I use Gradio in Claude Cowork?
Zip the skill folder so SKILL.md sits at the top level of the folder. Open Customize → Skills, click +, then upload the ZIP. Start a task that matches the description, or call it by name with /.
Is Gradio safe to install?
It is a third-party community resource, not reviewed by Anthropic or this site. Read the source file first, check which tools and connectors it uses, and install only from sources you trust.
Similar resources
- Huggingface Skills Core Hugging Face Hub operations through the hf CLI, including skill installation, repo management, jobs, datasets, models, Spaces, and discovery. Plugin · huggingface/skills
- Reddit Fetch Fetch content from Reddit via its JSON API using a browser session (DuckDuckGo-hop unlock). Use when accessing Reddit URLs, researching topics on Reddit, or when Reddit returns 403/blocked errors. Skill · ykdojo/claude-code-tips
- Angular Architect Generates Angular 17+ standalone components, configures advanced routing with lazy loading and guards, implements NgRx state management… Skill · Jeffallan/claude-skills
- Drawio Skill Use when the user requests diagrams, flowcharts, architecture diagrams, ER diagrams, UML / sequence / class diagrams, network topology… Skill · Agents365-ai/drawio-skill
- Skill Seekers (Doc Converter) Automatically converts any documentation website into a Claude AI skill in minutes Skill · yusufkaraaslan/Skill_Seekers
- Google AI Skills 11 official skills from Google Labs and Gemini for AI-powered development Skill · google-labs-code/stitch-skills
- Create Plan Create a concise plan. Use when a user explicitly asks for a plan related to a coding task. Skill · composio-community/awesome-codex-skills
- NotebookLM Integration Lets Claude Code chat directly with NotebookLM for source-grounded answers based exclusively on uploaded documents Skill · PleasePrompto/notebooklm-skill