Skip to main content
Gradio Lite (@gradio/lite) allows you to run Gradio applications entirely in the browser using WebAssembly and Pyodide. This means you can create interactive machine learning demos without any server infrastructure.

Overview

Gradio Lite runs Python code directly in the browser using Pyodide, a Python distribution compiled to WebAssembly. This enables:
  • Serverless demos: No backend infrastructure needed
  • Static hosting: Deploy to GitHub Pages, Netlify, or any static host
  • Privacy: All computation happens client-side
  • Instant loading: No server cold starts
Gradio Lite is ideal for lightweight demos and educational content. For production apps with heavy computation or external dependencies, consider regular Gradio deployed to Hugging Face Spaces.

Quick start

Create an HTML file with your Gradio app embedded:
That’s it! Open this HTML file in a browser to see your Gradio app running entirely client-side.

Installation

Include Gradio Lite from a CDN:

Via npm

For bundled applications:

Writing Gradio Lite apps

Basic structure

Write your Gradio Python code inside <gradio-lite> tags:

Multiple files

Organize code across multiple files using <gradio-file> tags:

Install dependencies

Specify Python packages to install:
Only packages available in Pyodide can be installed. Check the Pyodide package list for available packages.

Examples

Image processing

Data visualization

Text processing

Deployment

Gradio Lite apps are just HTML files, so you can deploy them anywhere:

GitHub Pages

  1. Create an index.html file with your Gradio Lite app
  2. Push to a GitHub repository
  3. Enable GitHub Pages in repository settings
  4. Your app will be live at https://username.github.io/repo-name

Netlify

  1. Create an index.html file
  2. Drag and drop to Netlify Drop
  3. Get an instant deployment URL

Any static host

Deploy to:
  • Vercel
  • Cloudflare Pages
  • AWS S3 + CloudFront
  • Google Cloud Storage
  • Or any web server

Limitations

Gradio Lite has some limitations compared to regular Gradio:
  • Package availability: Only Pyodide-compatible packages work
  • Performance: WebAssembly is slower than native Python for heavy computation
  • File size: Large dependencies increase initial load time
  • Browser compatibility: Requires modern browsers with WebAssembly support
  • No server features: No server-side APIs, databases, or external services

Best practices

1

Keep dependencies minimal

Only include packages you actually need. Fewer dependencies = faster load times.
2

Optimize for client-side

Gradio Lite works best for lightweight processing. For heavy models, use regular Gradio.
3

Test in multiple browsers

Verify your app works in Chrome, Firefox, Safari, and Edge.
4

Add loading indicators

The initial load can take time. Consider adding a loading message.

When to use Gradio Lite

Good use cases ✅

  • Educational demos and tutorials
  • Simple data visualizations
  • Text processing tools
  • Mathematical calculators
  • Image filters and transformations
  • Static portfolio projects
  • Large ML models (use Hugging Face Spaces)
  • Heavy computation (use server-side Gradio)
  • Real-time data from APIs (needs backend)
  • Production applications (needs reliability)
  • Apps requiring authentication (needs server)

Next steps

Sharing apps

Learn about sharing regular Gradio apps

Hugging Face Spaces

Deploy full Gradio apps to Spaces