Closed freddyaboulton closed 1 month ago
• | Name | Status | URL |
---|---|---|---|
Spaces | Spaces preview | ||
Website | Website preview | ||
:unicorn: | Changes | Details |
Install Gradio from this PR
pip install https://gradio-builds.s3.amazonaws.com/7a875584690253279c7ac6a5261782de621fea3e/gradio-4.31.5-py3-none-any.whl
Install Gradio Python Client from this PR
pip install "gradio-client @ git+https://github.com/gradio-app/gradio@7a875584690253279c7ac6a5261782de621fea3e#subdirectory=client/python"
Install Gradio JS Client from this PR
npm install https://gradio-builds.s3.amazonaws.com/7a875584690253279c7ac6a5261782de621fea3e/gradio-client-0.19.4.tgz
Package | Version |
---|---|
gradio |
patch |
Fix bug in reload mode equality check. Better equality conversion for state variables
Maintainers or the PR author can modify the PR title to modify this entry.
Oh I'm hesitant about this one. The reason why reactive code blocks in svelte don't automatically do deep equality checks with lists/objects is that it could be extremely expensive accidentally. The problem in this PR is that we are going to be doing deep checks on any state change at all, even if there's no change event listener attached to the state object.
let developers define their own state equality check function
I think it is very likely that developers will see their performance degrade and not have any idea why this is happening.
I don't mind the deep check in reload mode, it's okay if we add lag on reload, but I'd feel more comfortable using deep checks for state changes only if we also only do state change checks if there is a change event listener for the state variable. That way the deep check is only happening when explicitly requested to.
Thank you @aliabid94 @abidlabs for the reviews!!
Description
Closes #8384
Fixes the linked issue specific reload mode. But the equality check for state, basically
current_state != old_state
would throw an error for some types like numpy/dataframe. So proposing a function to handle that case.🎯 PRs Should Target Issues
Before your create a PR, please check to see if there is an existing issue for this change. If not, please create an issue before you create this PR, unless the fix is very small.
Not adhering to this guideline will result in the PR being closed.
Tests
PRs will only be merged if tests pass on CI. To run the tests locally, please set up your Gradio environment locally and run the tests:
bash scripts/run_all_tests.sh
You may need to run the linters:
bash scripts/format_backend.sh
andbash scripts/format_frontend.sh