Skip to main content
Gradio makes it easy to share your machine learning demos with others. You can create temporary share links, add authentication, embed demos in websites, and more. The fastest way to share your app is with the share=True parameter:
This generates a public link like https://07ff8706ab.gradio.live that you can share with anyone. Sharing
  • Share links are valid for 72 hours
  • Share links are publicly accessible
  • Processing happens on your local device
  • Your device must stay online
Share links are perfect for:
  • Quick demos to colleagues
  • Testing with remote users
  • Temporary showcases
  • Development and debugging
Share links are public! Anyone with the link can use your app. Don’t expose sensitive information or allow critical operations without authentication.

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 using gr.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.
Create shareable links that capture the current state of your app:
Users can click the deep link button to get a URL that preserves all component values at that moment.
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 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

Available attributes:
  • src: Full URL to the Gradio app
  • space: Shorthand for Hugging Face Spaces (username/space-name)
  • eager: Load immediately (true) or lazily (false, default)
  • initial_height: Height while loading (default 300px)
  • container: Show border and hosting info (default true)
  • info: Show hosting info only (default true)
  • autoscroll: Auto-scroll to output (default false)
  • theme_mode: light, dark, or system (default)
  • control_page_title: Set page title to app title (default false)

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
API page Learn more in the Python client and JavaScript client guides.

Rate limiting

Protect your public API from abuse:
For OAuth users, rate limit by username instead of IP:

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
No user data from your app is collected.

Disable analytics

Or set globally:

Progressive Web Apps (PWA)

Make your Gradio app installable as a PWA:
Users can install your app on their device: Installing PWA

Next steps

Hugging Face Spaces

Deploy to Hugging Face Spaces for permanent hosting

Docker deployment

Deploy Gradio apps with Docker