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
[Blocks] State
throws a js error
#730
Comments
Different error, but still an issue. Try running |
Closed via #977 |
Hey @abidlabs , There is still an issue. Reproduce with colab or check out this space. The space just keeps loading. |
@aliabid94 could you take a look? |
The default way to use state with Blocks is to use Variables. But imo this approach should be accepted as well since this is what users will be used to coming from Interface --> we can simply create a Variable if a user tries to use a "state" as an input or output. Also we need to document all of this better, see #1739 |
I've been looking into this issue and can take it! |
Thanks @aliabd for creating the issue, this should be fixed now, as long as State is used correctly, as follows: import gradio as gr
def chat(message, history):
history = history or []
history.append((message, message))
return history, history
block = gr.Blocks()
with block:
chatbot = gr.Chatbot()
message = gr.Textbox()
state = gr.State()
submit = gr.Button("SEND")
submit.click(chat, inputs=[message, state], outputs=[chatbot, state])
block.launch() |
Describe the bug
Using
State
withChatbot
throws an error.Reproduction
Throws this console error:
Nothing is rendered on the page.
Replacing the block launch with
works as expected
Screenshot
No response
Logs
No response
System Info
Severity
blocker
The text was updated successfully, but these errors were encountered: