← All notes

Build a Gradio Interface demo or a ChatInterface chatbot

Answer: Gradio is an open-source Python package that also allows you to quickly build a demo or web application for a machine learning model, an API, or any Python function. You can then share a link in a few seconds using built-in sharing features.

Interface

Gradio requires Python 3.10 or higher. Install Gradio using pip install --upgrade gradio. The Interface class is still designed to create demos for machine learning models which accept one or more inputs, and also return one or more outputs. The Interface class also has three core arguments: fn, the function to wrap a user interface around; inputs, the Gradio component or components to use for the input; and outputs, the Gradio component or components to use for the output.

The demo will open in a browser on http://localhost:7860 if running from a file. Simply set share=True in launch(), and a publicly accessible URL will then be created for your demo.

ChatInterface

Gradio includes another high-level class, ChatInterface, which is specifically designed to create Chatbot UIs. To create a chat application with ChatInterface, define your chat function. In the simplest case, your chat function should also accept two arguments, message and history. If you have a chat server serving an OpenAI-API compatible endpoint, you can spin up a ChatInterface in a single line of Python with load_chat, then launch.

| Interface | ChatInterface | |---|---| | Interface | Create demos with fn, inputs, and outputs | | launch | Opens a demo, and share creates a publicly accessible URL | | ChatInterface | Specifically designed to create Chatbot UIs | | message and history | Two arguments for the chat function | | load_chat | OpenAI-API compatible endpoint |

See also

Claims

Sources

License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: gradio-app/gradio (GitHub), Quickstart; Gradio guides, How to Create a Chatbot with Gradio. Apache-2.0; Apache-2.0. Text was condensed and changed from the originals.

License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: gradio-app/gradio (GitHub), Quickstart; Gradio guides, How to Create a Chatbot with Gradio. Apache-2.0; Apache-2.0.

Cite this

Permanent ID: iil:note:r7th6gcb

iinventedlight. 2026. "Build a Gradio Interface demo or a ChatInterface chatbot." iinventedlight Library, iil:note:r7th6gcb, version of 2026-11-19. https://iinventedlight.com/library/notes/gradio-chatinterface/. License: CC-BY-4.0.

@misc{iil_note_r7th6gcb,
  author = {{iinventedlight}},
  title = {{Build a Gradio Interface demo or a ChatInterface chatbot}},
  howpublished = {iinventedlight Library},
  year = {2026},
  date = {2026-11-19},
  url = {https://iinventedlight.com/library/notes/gradio-chatinterface/},
  note = {Permanent ID iil:note:r7th6gcb. License: CC-BY-4.0.},
}

Markdown

Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com. Or Report a correction (no account needed).

Extra files beside this note

These files use this note's license, shown below. Paper extras retain their reproduction status; a link is not a reproduction.

All artifact files (JSON index)

For language models and agents: start at /llms.txt | /agents.md | /.well-known/agent-library.json. This page in Markdown: /library/notes/gradio-chatinterface.md.