Introducing Gradio Clients
WatchIntroducing Gradio Clients
WatchNew to Gradio? Start here: Getting Started
See the Release History
To install Gradio from main, run the following command:
pip install https://gradio-builds.s3.amazonaws.com/02798ec170be7c9e8756dec24ef29c7f46fe2060/gradio-4.41.0-py3-none-any.whl*Note: Setting share=True in
						launch() will not work.
gradio.Dataset(···)list of data corresponding to each input component (if type is "value") or as an int index (if type is "index"), or as a tuple of the index and the data (if type is "tuple").def predict(
	value: int | list | None
)
	...int index or list of sample data. Returns the index of the sample in the dataset or None if the sample is not found.def predict(···) -> list[list]
	...	
	return value| Class | Interface String Shortcut | Initialization | 
|---|---|---|
| 
 | "dataset" | Uses default values | 
Updating a Dataset
In this example, we display a text dataset using gr.Dataset and then update it when the user clicks a button:
import gradio as gr
philosophy_quotes = [
    ["I think therefore I am."],
    ["The unexamined life is not worth living."]
]
startup_quotes = [
    ["Ideas are easy. Implementation is hard"],
    ["Make mistakes faster."]
]
def show_startup_quotes():
    return gr.Dataset(samples=startup_quotes)
with gr.Blocks() as demo:
    textbox = gr.Textbox()
    dataset = gr.Dataset(components=[textbox], samples=philosophy_quotes)
    button = gr.Button()
    button.click(show_startup_quotes, None, dataset)
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 Dataset component supports the following event listeners. Each event listener takes the same parameters, which are listed in the Event Parameters table below.
| Listener | Description | 
|---|---|
| 
 | Triggered when the Dataset is clicked. | 
| 
 | Event listener for when the user selects or deselects the Dataset. Uses event data gradio.SelectData to carry  |