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
- id: C1 claim: gr.Interface wraps a Python function with inputs and outputs and can share a public URL via launch(share=True). source: S1 evidence: "set
share=Trueinlaunch()"
- id: C2 claim: ChatInterface is the high-level Gradio class for chatbot UIs. source: S1 evidence: "specifically designed to create Chatbot UIs"
- id: C3 claim: A ChatInterface function should accept message and history, and load_chat can wrap an OpenAI-compatible endpoint. source: S2 evidence: "accept two arguments:
messageandhistory"
Sources
- [S1] Quickstart. gradio-app/gradio (GitHub). https://github.com/gradio-app/gradio/blob/main/guides/01_getting-started/01_quickstart.md . License: Apache-2.0. Accessed 2026-11-19.
- [S2] How to Create a Chatbot with Gradio. Gradio guides. https://www.gradio.app/guides/creating-a-chatbot-fast . License: Apache-2.0. Accessed 2026-11-19.
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
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.},
}
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.
- gradio-chatinterface.table.json (table; CC-BY-4.0)
- gradio-chatinterface.schema.json (schema; CC-BY-4.0)
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.