Introducing Gradio Clients
WatchIntroducing Gradio Clients
WatchNew to Gradio? Start here: Getting Started
See the Release History
gradio.BarPlot(···)
def predict(
value: AltairPlotData
)
...
x
argument) and one for the y-axis (corresponding to y
).def predict(···) -> pd.DataFrame | None
...
return value
Class | Interface String Shortcut | Initialization |
---|---|---|
| "barplot" | Uses default values |
import gradio as gr
from scatter_plot_demo import scatter_plots
from line_plot_demo import line_plots
from bar_plot_demo import bar_plots
with gr.Blocks() as demo:
with gr.Tabs():
with gr.TabItem("Line Plot"):
line_plots.render()
with gr.TabItem("Scatter Plot"):
scatter_plots.render()
with gr.TabItem("Bar Plot"):
bar_plots.render()
if __name__ == "__main__":
demo.launch()
Event listeners allow you to respond to user interactions with the UI components you've defined in a Gradio Blocks app. When a user interacts with an element, such as changing a slider value or uploading an image, a function is called.
The BarPlot component supports the following event listeners. Each event listener takes the same parameters, which are listed in the Event Parameters table below.
Listener | Description |
---|---|
| Event listener for when the user selects or deselects the NativePlot. Uses event data gradio.SelectData to carry |
| Triggered when the NativePlot is double clicked. |