LinuxCommandLibrary

gradio

TLDR

Run Gradio app

$ python [app.py]
copy
Launch with share link
$ gradio [app.py] --share
copy
Specify port
$ gradio [app.py] --server-port [7861]
copy
Enable debug mode
$ gradio [app.py] --debug
copy

SYNOPSIS

gradio [file] [options]

DESCRIPTION

Gradio is a Python library for creating machine learning demos and web interfaces. It allows rapid prototyping of ML models with interactive UIs, supporting inputs like text, images, audio, and video.
Gradio interfaces can be shared via temporary public URLs, making it easy to demonstrate models to others. It's widely used in the Hugging Face ecosystem.

PARAMETERS

file

Python file with Gradio interface.
--share
Create public shareable link.
--server-port port
Port number (default 7860).
--server-name host
Host address.
--debug
Enable debug mode.
--reload
Auto-reload on changes.

PYTHON EXAMPLE

$ import gradio as gr

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

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

CAVEATS

Requires Python 3.7+. Share links expire after 72 hours. Large models need appropriate resources. WebSocket connections required for interactivity.

HISTORY

Gradio was created by Abubakar Abid and team, acquired by Hugging Face in 2022. It revolutionized ML demo creation by making interactive interfaces accessible to researchers without web development expertise.

SEE ALSO

streamlit(1), python(1), flask(1)

Copied to clipboard