- Helpers
- LikeData
New 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/3fcd23a09df280468351eac4fb081e79c8e58216/gradio-6.0.1-py3-none-any.whl*Note: Setting share=True in launch() will not work.
LikeData
gradio.LikeData(···)Description
The gr.LikeData class is a subclass of gr.EventData that specifically carries information about the .like() event. When gr.LikeData is added as a type hint to an argument of an event listener method, a gr.LikeData object will automatically be passed as the value of that argument. The attributes of this object contains information about the event that triggered the listener.
Example Usage
import gradio as gr
def test(value, like_data: gr.LikeData):
return {
"chatbot_value": value,
"liked_message": like_data.value,
"liked_index": like_data.index,
"liked_or_disliked_as_bool": like_data.liked
}
with gr.Blocks() as demo:
c = gr.Chatbot([("abc", "def")])
t = gr.JSON()
c.like(test, c, t)
demo.launch()Attributes
Parameters