gradio-app /gradio
Build and share delightful machine learning apps, all in Python. 🌟 Star to support our work!
★ 44,016⑂ 3,661👁 203⑃ 6,772● 6,837▤ 1,000◈ 0
44,016
stars
+11
3,661
forks
203
watchers
6,772
prs
6,837
issues
1,000
releases
0
discussions
README
!Python version
Website
| Documentation
| Guides
| Getting Started
| Examples
Gradio: Build Machine Learning Web Apps — in Python
Gradio is an open-source Python package that allows you to quickly build a demo or web application for your machine learning model, API, or any arbitrary Python function. You can then share a link to your demo or web application in just a few seconds using Gradio's built-in sharing features. No JavaScript, CSS, or web hosting experience needed!
It just takes a few lines of Python to create your own demo, so let's get started 💫
Installation
Prerequisite: Gradio requires Python 3.10 or higher.
We recommend installing Gradio using pip, which is included by default in Python. Run this in your terminal or command prompt:
bash
pip install --upgrade gradio
[!TIP]
It is best to install Gradio in a virtual environment. Detailed installation instructions for all common operating systems are provided here.
Building Your First Demo
You can run Gradio in your favorite code editor, Jupyter notebook, Google Colab, or anywhere else you write Python. Let's write your first Gradio app:
python
import gradio as gr
def greet(name, intensity):
return "Hello, " + name + "!" int(intensity)
demo = gr.Interface(
fn=greet,
inputs=["text", "slider"],
outputs=["text"],
api_name="predict"
)
demo.launch()
[!TIP]
We shorten the imported name from gradio to gr. This is a widely adopted convention for better readability of code.
Now, run your code. If you've written the Python code in a file named app.py, then you would run python app.py from the terminal.
The demo below will open in a browser on http://localhost:7860 if running from a file. If you are running within a notebook, the demo will appear embedded within the notebook.
!hello_world_4 demo
Type your name in the textbox on the left, drag the slider, and then press the Submit button. You should see a friendly greeting on the right.
[!TIP]
When developing locally, you can run your Gradio app in hot reload mode, which automatically reloads the Gradio app whenever you make changes to the file. To do this, simply type in gradio before the name of the file instead of python. In the example above, you would type: gradio app.py in your terminal. You can also enable vibe mode by using the --vibe flag, e.g. gradio --vibe app.py, which provides an in-browser chat that can be used to write or edit your Gradio app using natural language. Learn more in the Hot Reloading Guide.
Understanding the Interface Class
You'll notice that in order to make your first demo, you created an instance of the gr.Interface class. The Interface class is designed to create demos for machine learning models which accept one or more inputs, and return one or more outputs.
The Interface class has three core arguments:
- fn: the function to wrap a user interface (UI) around
- inputs: the Gradio component(s) to use for the input. The number of components shTop issues
#10487Session not found whenever the request is routed to another instance15 comments · 2025-02-02#13832gradio v6.28+: Dropdown label not shown on field when option value is None10 comments · 2026-09-08#9230Feature: DownloadButton generate data on-the-fly and download7 comments · 2024-08-31#9824ZeroGPU integration tracking6 comments · 2024-10-23#13837CSV-injection sanitizer misses carriage-return (\r) prefix4 comments · 2026-09-09#13973Docs: Modal deployment example fails with IndentationError3 comments · 2026-10-14#13630gr.Workflow: downstream fn nodes still execute (with None inputs) after an upstream node fails3 comments · 2026-07-17#13586Can we please add feature to get full file path of file uploads?3 comments · 2026-07-03
Latest release
[email protected] [email protected] 2026-10-28Features - 13958 de986c7 - Write gr.Video format conversions and watermarks into the cache. Thanks @abidlabs! - 13966 4b58c80 - forward ZeroGPU X-IP-Token from gr.Workflow + stop reporting quota errors as GPU unavailable. Thanks @hannahblair! - 13994 15199c0 - handle system clashing with browser scrolling in gr.workflow. Thanks @hannahblair! - 13996 336590f - workflow: ensure inline checkbox works. Thanks @hannahblair! - 13971 b3c050c - fit gr.workflow in full screen layouts. Thanks @hannahblair! - 13963 3570032 - ensure app/workflow toggle is visible in tall spaces. Thanks