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/63048975c6c055ac33360d21e760b9ce8f035ff5/gradio-4.37.2-py3-none-any.whl
*Note: Setting share=True
in
launch()
will not work.
gradio.EventData(ยทยทยท)
.target
attribute that refers to the component that triggered the event, while subclasses of gr.EventData contains additional attributes that are different for each class. import gradio as gr
with gr.Blocks() as demo:
table = gr.Dataframe([[1, 2, 3], [4, 5, 6]])
gallery = gr.Gallery([("cat.jpg", "Cat"), ("dog.jpg", "Dog")])
textbox = gr.Textbox("Hello World!")
statement = gr.Textbox()
def on_select(value, evt: gr.EventData):
return f"The {evt.target} component was selected, and its value was {value}."
table.select(on_select, table, statement)
gallery.select(on_select, gallery, statement)
textbox.select(on_select, textbox, statement)
demo.launch()
Parameter | Description |
---|---|
target Block | None | The component object that triggered the event. Can be used to distinguish multiple components bound to the same listener. |