Skip to content

Develop UI with Gradio

Gradio is the fastest way to demo stuff with a user interface. One of its advantages against StreamLit is the capacity to share data between pages and elements.

Quickstart

# For continuous development
gradio main.py
# For running a server
python main.app

Open in a browser on http://localhost:7860

My first app

Main concepts

  • A python function can be wrapped with a user interface
  • Use gr.Blocks to develop custom interface. Components are automatically added to the Blocks as they are created within the with clause. It is a classic python function.
  • Any Component that acts as an input to an event listener is made interactive
  • Global state can be set via variable at the top of the program, and are shared between connected session

  • Chatbot and ChatInterface to build simple user interface for a chat bot demo.

How to