gradio-app / gradio

Build and share delightful machine learning apps, all in Python. 🌟 Star to support our work!
http://www.gradio.app
Apache License 2.0
29.84k stars 2.22k forks source link

Input event in gr.Dataframe is also triggered at function updates and at app start #8231

Open bergerchris opened 3 weeks ago

bergerchris commented 3 weeks ago

Describe the bug

The input event of the dataframe should only be triggered, when the user makes inputs but it is also triggered at app startup and when a function makes changes.

Have you searched existing issues? 🔎

Reproduction

import gradio as gr

def trigger():
    return "TRIGGER"

def change_df():
    return [['INPUT']]

with gr.Blocks() as demo:
    dataframe = gr.Dataframe(label="Name", interactive=True)
    textbox = gr.Textbox(label="Output Box", interactive=True)
    button = gr.Button('Change Dataframe')

    dataframe.input(fn=trigger, outputs=textbox)
    button.click(fn=change_df, outputs=dataframe)

if __name__ == "__main__":
    demo.launch()

Screenshot

No response

Logs

No response

System Info

Example from Gradio Playground

Severity

I can work around it