Quick sharing with share links
The fastest way to share your app is with theshare=True parameter:
https://07ff8706ab.gradio.live that you can share with anyone.
- Share links are valid for 72 hours
- Share links are publicly accessible
- Processing happens on your local device
- Your device must stay online
When to use share links
Share links are perfect for:- Quick demos to colleagues
- Testing with remote users
- Temporary showcases
- Development and debugging
Authentication
Basic username/password
Add simple authentication to your app:Multiple users
Support multiple username/password pairs:Custom authentication logic
Implement custom authentication functions:Access logged-in username
Get the current user’s username usinggr.Request:
Logout functionality
Add a logout button:By default,
/logout logs out from all sessions. To logout only the current session, use /logout?all_session=false.OAuth with Hugging Face
Enable “Sign in with Hugging Face” for your Space:1
Set metadata
Add to your Space’s
README.md:2
Add login button
3
Access user profile
Use
gr.OAuthProfile to get user information:OAuth features only work on Hugging Face Spaces. For local testing, log in with
huggingface-cli login or set the HF_TOKEN environment variable.Deep links
Create shareable links that capture the current state of your app:Deep links require your app to be publicly accessible (hosted on Spaces or using
share=True).Embedding Gradio apps
Once your app is hosted (on Hugging Face Spaces or your own server), you can embed it in websites.Web Components (recommended)
Web components offer better performance and automatic height adjustment:1
Include the Gradio library
Add to your HTML
<head>:2
Add the component
Place where you want the app:
Customization options
src: Full URL to the Gradio appspace: Shorthand for Hugging Face Spaces (username/space-name)eager: Load immediately (true) or lazily (false, default)initial_height: Height while loading (default300px)container: Show border and hosting info (defaulttrue)info: Show hosting info only (defaulttrue)autoscroll: Auto-scroll to output (defaultfalse)theme_mode:light,dark, orsystem(default)control_page_title: Set page title to app title (defaultfalse)
Listen to events
IFrames
For sites where you can’t add JavaScript:Set a fixed
height and use style="border:0;" to remove borders. Add allow attributes for webcam/microphone access.API access
Every Gradio app automatically exposes an API. Users can click “Use via API” in the app footer to see:- Available endpoints
- Parameter types
- Example code for Python and JavaScript clients
- Interactive API recorder
Learn more in the Python client and JavaScript client guides.
Rate limiting
Protect your public API from abuse:Analytics
By default, Gradio collects basic analytics to improve the library:- Environment (Colab, Spaces, etc.)
- Components used
- Advanced features enabled
- Unique developer count (via IP)
- Gradio version
Disable analytics
Progressive Web Apps (PWA)
Make your Gradio app installable as a PWA:
Next steps
Hugging Face Spaces
Deploy to Hugging Face Spaces for permanent hosting
Docker deployment
Deploy Gradio apps with Docker