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
30.56k stars 2.27k forks source link

How to modify State(list) to trigger State.change() #8436

Closed coolboyqu closed 3 weeks ago

coolboyqu commented 3 weeks ago

It seems that state.change() can only be triggered when variables' id changes, such as int, str, etc. For a list, if only the elements in the list are modified, state.change() cannot be triggered unless a new copy of the list is copied and returned. However, copying the list every time can waste a lot of time and resources. Is there any way to add elements to the list and trigger state.change() without copying the list?

abidlabs commented 3 weeks ago

We're looking into a solution for this! cc @aliabid94