Core Concepts
Reasoning
Memory & Retrieval
Agent Types
Design Patterns
Training & Alignment
Frameworks
Tools
Safety & Security
Evaluation
Meta
Core Concepts
Reasoning
Memory & Retrieval
Agent Types
Design Patterns
Training & Alignment
Frameworks
Tools
Safety & Security
Evaluation
Meta
Gradio is an open-source Python library for rapidly building interactive web demos and applications for machine learning models. It requires no JavaScript, CSS, or web hosting knowledge, enabling developers to create shareable UIs in minutes with seamless Hugging Face Spaces integration.1)
Gradio demos wrap a Python function with input and output components. The simplest approach uses the Interface class:2)
demo.launch() to start a local web serverEnhancements include titles, descriptions (supporting Markdown and HTML), and pre-loaded examples for user guidance.
Gradio offers two primary APIs for building UIs:3)
Interface:
fn, inputs, and outputsBlocks API:
Gradio provides 20+ pre-built components:4)
gr.Textbox, gr.Markdown, gr.Codegr.Image, gr.Audio, gr.Videogr.Dataframe, gr.JSON, gr.Labelgr.Slider, gr.Dropdown, gr.Checkbox, gr.Radiogr.File, gr.UploadButton
Components are customizable via properties like labels, placeholders, and styling. Shortcuts (e.g., “textbox” instead of gr.Textbox()) enable rapid setup.
In Blocks, events are attached to components for dynamic behavior:5)
click – button press actionschange – input value changessubmit – form submissionsGradio demos deploy instantly to Hugging Face Spaces for free hosting:6)
gr.load()launch(share=True) creates a temporary public URL via Gradio's tunneling serviceGradio supports creating custom components for specialized needs:7)