-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reload mode should preserve states #8855
Comments
Ah yeah I think adding btw @irgolic can you share a small code snippet so that we can use to test? |
Sure, here's a quick demo: import gradio as gr
with gr.Blocks() as demo:
my_state = gr.State([])
@gr.render(inputs=[my_state])
def _(rows):
for r in rows:
gr.Textbox(r)
button = gr.Button("+")
button.click(lambda l: l + ["row"], my_state, my_state)
demo.launch() |
Any updates on this? Anything I can do to help expedite? |
Hi @irgolic - we're busy preparing a 5.0 major release. Contributions on this are welcome - we'd be happy to review any PRs :) 🙏 |
Hi @freddyaboulton, good luck with the release! I'd love to contribute, could you review my other outstanding PR first? |
Is your feature request related to a problem? Please describe.
I have some components where input variables are specified, they're generated by a
gr.render
decorator though, so the actual values are stored in a state. The state does not persist reloads, and I need to input the values every time it reloads.The same does not hold for normal textboxes – those persist just fine.
Describe the solution you'd like
Upon hot reload,
gr.State
values should stay what they are. Perhaps akey
argument should be added togr.State
to facilitate this.The text was updated successfully, but these errors were encountered: