Skip to main content

Gradio Cheatsheet

Gradio is the fastest way to build ML/AI demo interfaces in Python. Launch a web UI with one line, supports drag-and-drop component composition, one-click sharing via public links, and deployment to HuggingFace Spaces. Also features a built-in CLI chat interface (gradio cc).

Updated: 2026-07-20·16 commands

Quick Start

``bash # Install pip install gradio

# Run an app (dev mode with hot reload) gradio app.py

# Create a public share link gradio app.py --share

# CLI chat with AI gradio cc --model gpt-4o

# Deploy to HuggingFace Spaces gradio deploy `

App Development

Create a Python file with a Gradio interface function. The gradio CLI runs it in development mode with auto-reload. Supports text, image, audio, video, and many other input/output component types.

Sharing

--share creates a public URL via Gradio Share tunnel (valid for 72 hours). Perfect for sharing demos with clients or collaborators without deploying anywhere.

HuggingFace Spaces

gradio deploy handles the full deployment workflow: creates a Space repo on HuggingFace, uploads your code, sets up the environment, and provides a permanent URL. Spaces support GPU acceleration for model inference.

CLI Chat

gradio cc` provides a terminal-based chat interface. Supports various AI models via API backends. Useful for quick testing without building a full UI.

Startup & Modes(9)

CommandLevel
gradio --help
Show Gradio CLI help
Basic
gradio app.py
Run Gradio app (dev mode, hot reload)
Basic
gradio app.py --port
Specify the port to run on
Basic
gradio app.py --share
Create public share link (Gradio Share)
Basic
pip install gradio
Install Gradio
Basic
gradio cc
Command-line chat interface (talk to AI models)
Basic
gradio cc --model
Specify model in CLI chat
Basic
gradio demo
Create reference demo template
Basic
gradio app.py --analytics-enabled
Disable usage analytics
Basic

ai-server(7)

CommandLevel
gradio deploy
Deploy to HuggingFace Spaces
Intermediate
gradio deploy --title
Specify Space title
Intermediate
gradio deploy --app-file
Specify app entry file
Intermediate
gradio space create
Create a HuggingFace Space
Intermediate
gradio space delete
Delete a HuggingFace Space
Intermediate
gradio app.py --root-path
Set app root path (for reverse proxy)
Intermediate
gradio app.py --auth
Enable username/password authentication
Intermediate

FAQ

This cheatsheet is compiled from official tool documentation. Last updated: 2026-07-20.