pip install gradio★Python 3.10+. Bundles the server, the web UI, andgradio_client. CLI:gradio app.pyruns with auto-reload for dev.import gradio as gr def greet(name): return f"Hello {name}!"★Your app is just a Python function. Gradio builds the UI around its inputs and outputs.demo = gr.Interface(fn=greet, inputs="textbox", outputs="textbox") demo.launch()★Interfacemapsfn's args to input components and its returns to output components. Strings are shorthand for components.gr.Interface(classify, gr.Image(), gr.Label(num_top_classes=3))Pass component instances for full control. Order ofinputs/outputsmatches the function signature/returns.
gr.Interface(fn, inputs, outputs, title="...", description="...", examples=[["cat.jpg"]])★examplesrenders clickable sample inputs;title/description/articleadd text (Markdown/HTML).gr.Interface(..., live=True)Re-run automatically whenever an input changes — no submit button. Great for sliders/filters.gr.Interface(..., flagging_mode="manual")Let users flag outputs to a CSV/dataset for later review.gr.Interface.from_pipeline(hf_pipeline).launch()One-liner UI for a Hugging Facetransformerspipeline — components are inferred from the task.