Buttons with Gradio

Learn about including buttons in Gradio applications, and how to assign actions to the buttons.

The Button component

The usage of a Button is quite self-explanatory. When instantiated, it will create a button, that can be assigned a myriad of arbitrary click events. The button label (or value) can be used as an input or set via the output of a function.

Press + to interact
Different kinds of buttons in Gradio
Different kinds of buttons in Gradio

To instantiate a Button, we type gr.Button().

There are different kinds of buttons, such as a clear button, duplicate button, login button, and logout button. These can be instantiated as gr.ClearButton(), gr.DuplicateButton(), gr.LoginButton() and gr.LogoutButton() respectively. They are identical and only differ in the value/label of the button.

Button supports some parameters upon initialization that affect how the button is displayed. The more notable ones include the ...

Access this course and 1400+ top-rated courses and projects.