ConfigsMar 31, 2026·2 min read

Gradio — Build ML Demos & AI Apps in Python

Python library for building interactive ML demos and AI web apps. Chat interfaces, file upload, image/audio/video I/O. Share with public link. 42K+ stars.

TO
TokRepo精选 · Community
Quick Use

Use it first, then decide how deep to go

This block should tell both the user and the agent what to copy, install, and apply first.

pip install gradio
import gradio as gr

def greet(name):
    return f"Hello, {name}!"

gr.Interface(fn=greet, inputs="text", outputs="text").launch()

Open http://localhost:7860 — shareable with a public link via share=True.


Intro

Gradio is the standard Python library for building interactive ML demos and AI web applications. Create chat interfaces, image generators, audio processors, and data tools with a few lines of Python — no frontend code needed. Used by Hugging Face, Stability AI, and thousands of ML projects. Automatically generates a web UI and optional public share link. 42,000+ GitHub stars, Apache 2.0.

Best for: ML engineers and researchers who need a quick web interface for their models Works with: Any Python ML library — PyTorch, TensorFlow, Hugging Face, OpenAI, Anthropic, Ollama


Key Features

Pre-Built Components

30+ I/O components: Textbox, Chatbot, Image, Audio, Video, File, DataFrame, Plot, Code, Markdown, and more.

Chat Interface

Production-ready chat UI in 3 lines:

gr.ChatInterface(fn=my_llm_function).launch()

Streaming

Real-time streaming for LLM responses, audio, and video.

Blocks API

Full layout control for complex multi-component apps:

with gr.Blocks() as demo:
    with gr.Row():
        input = gr.Textbox()
        output = gr.Textbox()
    btn = gr.Button("Submit")
    btn.click(fn=process, inputs=input, outputs=output)

Sharing

demo.launch(share=True) generates a public URL — share your app instantly without deployment.

Hugging Face Spaces

Deploy Gradio apps to Hugging Face Spaces for free permanent hosting.


FAQ

Q: What is Gradio? A: A Python library for building ML demos and AI web apps with interactive UIs. Chat, images, audio, video — no frontend code needed. 42K+ stars, used by Hugging Face.

Q: How is Gradio different from Streamlit? A: Gradio is ML-focused with specialized components (image/audio/video I/O, model inference). Streamlit is broader for data apps. Gradio has native Hugging Face Spaces integration.


🙏

Source & Thanks

Created by Gradio. Licensed under Apache 2.0. gradio-app/gradio — 42,000+ GitHub stars

Related Assets