gradio-app /gradio
Build and share delightful machine learning apps, all in Python. 🌟 Star to support our work!
★ 44,060⑂ 3,668👁 202⑃ 6,770● 6,846▤ 5,263
+6
日增长
+55
周增长
44,060
stars
3,668
forks
202
watchers
6,770
prs
6,846
issues
5,263
releases
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) prefix5 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-11-12Features - 14050 fda8037 - Use the visitor's own HF token for run history buckets. Thanks @dawoodkhan82! - 14034 1028366 - Allow Pillow 13 on 6.x and keep 32-bit integer PNG output working. Thanks @abidlabs! - 14042 2f8693a - Add GitHub-installed CLI extensions. Thanks @abidlabs! - 14059 5819440 - add console forwarding for embedded apps. Thanks @pngwn! - 14017 ebccfcf - workflows: handle depth estimation. Thanks @hannahblair! - 13972 d702b19 - workflow: add masked setting on textboxes. Thanks @hannahblair! - 14057 ab27f92 - workflow: add 3d model node support. Thanks @ha