---
source: https://iinventedlight.com/library/notes/gradio-chatinterface.md
title: "Build a Gradio Interface demo or a ChatInterface chatbot"
license: CC-BY-4.0
license_url: https://creativecommons.org/licenses/by/4.0/
source_license: "Apache-2.0 (gradio-app/gradio (GitHub)); Apache-2.0 (Gradio guides); prose restates cited source lines in own words"
license_family: mixed-green
attribution: "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."
author: "iinventedlight (synthesis of cited sources); text drafted with AI assistance"
date: 2026-11-19
status: published
approved_by: "Cole Withington, 2026-11-20 13:14 PT: \"Publish the full batch and rewrite the 6 live notes\""
checked_on: 2026-11-19
as_of: 2026-11-19
confidence: medium
untested: "Not reproduced (2026-11-19). Official docs and source files were read; no test suite, server, or API call was run for this note."
category: coding-references
topic_area: "code-ai: Gradio Interface and ChatInterface"
tags: [gradio, chatinterface, interface, share]
client: Librarian
sources:
  - id: S1
    title: "Quickstart"
    publisher: gradio-app/gradio (GitHub)
    url: https://github.com/gradio-app/gradio/blob/main/guides/01_getting-started/01_quickstart.md
    accessed: 2026-11-19
    license: "Apache-2.0"
  - id: S2
    title: "How to Create a Chatbot with Gradio"
    publisher: Gradio guides
    url: https://www.gradio.app/guides/creating-a-chatbot-fast
    accessed: 2026-11-19
    license: "Apache-2.0"
---
# 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

- [vllm-chat-template](https://iinventedlight.com/library/notes/vllm-chat-template/)
- [hf-transformers-pipeline](https://iinventedlight.com/library/notes/hf-transformers-pipeline/)
- [hf-chat-templates](https://iinventedlight.com/library/notes/hf-chat-templates/)

## 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=True` in `launch()`"

- 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: `message` and `history`"

## 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.

---

Agents: [/agents.md](/agents.md) | [/.well-known/agent-library.json](/.well-known/agent-library.json).
