Skip to content
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

Add gr.BrowserState change event #10245

Merged
merged 7 commits into from
Dec 23, 2024
Merged

Add gr.BrowserState change event #10245

merged 7 commits into from
Dec 23, 2024

Conversation

abidlabs
Copy link
Member

Closes: #10243

Run the updated demo/browserstate/run.py to verify

@abidlabs abidlabs changed the title Add browser change event Add gr.BrowserState change event Dec 23, 2024
@gradio-pr-bot
Copy link
Collaborator

gradio-pr-bot commented Dec 23, 2024

🪼 branch checks and previews

Name Status URL
Spaces ready! Spaces preview
Website ready! Website preview
Storybook ready! Storybook preview
🦄 Changes detected! Details

Install Gradio from this PR

pip install https://gradio-pypi-previews.s3.amazonaws.com/d7257d58cd1cf92338307099c2a286936529cec0/gradio-5.9.1-py3-none-any.whl

Install Gradio Python Client from this PR

pip install "gradio-client @ git+https://github.com/gradio-app/gradio@d7257d58cd1cf92338307099c2a286936529cec0#subdirectory=client/python"

Install Gradio JS Client from this PR

npm install https://gradio-npm-previews.s3.amazonaws.com/d7257d58cd1cf92338307099c2a286936529cec0/gradio-client-1.8.0.tgz

Use Lite from this PR

<script type="module" src="https://gradio-lite-previews.s3.amazonaws.com/d7257d58cd1cf92338307099c2a286936529cec0/dist/lite.js""></script>

@gradio-pr-bot
Copy link
Collaborator

gradio-pr-bot commented Dec 23, 2024

🦄 change detected

This Pull Request includes changes to the following packages.

Package Version
@gradio/browserstate minor
gradio minor
  • Maintainers can select this checkbox to manually select packages to update.

With the following changelog entry.

Add gr.BrowserState change event

Maintainers or the PR author can modify the PR title to modify this entry.

Something isn't right?

  • Maintainers can change the version label to modify the version bump.
  • If the bot has failed to detect any changes, or if this pull request needs to update multiple packages to different versions or requires a more comprehensive changelog entry, maintainers can update the changelog file directly.

Sorry, something went wrong.

…io into add-browser-change-event
change: never;
}>;

console.log("gradio", gradio);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove?

@dawoodkhan82
Copy link
Collaborator

dawoodkhan82 commented Dec 23, 2024

Should we add a clear event? I guess can be dispatched when the value is set to an empty string.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
@abidlabs
Copy link
Member Author

I don't think its necessary @dawoodkhan82, we typically only have a .clear() event when there's an actual "X" icon in the UI. So for example, the gr.Image component has a .clear() event but gr.Textbox() does not. In this case, you could listen for the .change() event and just check in your function if the value of the BrowserState component is ""

@dawoodkhan82 dawoodkhan82 self-requested a review December 23, 2024 22:44
Copy link
Collaborator

@dawoodkhan82 dawoodkhan82 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested and lgtm!

@abidlabs
Copy link
Member Author

Thanks @dawoodkhan82!

@abidlabs abidlabs merged commit 3e4e0de into main Dec 23, 2024
22 of 23 checks passed
@abidlabs abidlabs deleted the add-browser-change-event branch December 23, 2024 23:19
dawoodkhan82 pushed a commit that referenced this pull request Dec 27, 2024
* changes

* changes

* add changeset

* format

* changes

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
abidlabs added a commit that referenced this pull request Jan 4, 2025

Partially verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
We cannot verify signatures from co-authors, and some of the co-authors attributed to this commit require their commits to be signed.
* save history prototype

* add changeset

* Declare exports in __all__ for type checking (#10238)

* Declare exports

* add changeset

* type fixes

* more type fixes

* add changeset

* notebooks

* changes

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
Co-authored-by: Freddy Boulton <alfonsoboulton@gmail.com>
Co-authored-by: Abubakar Abid <abubakar@huggingface.co>

* Add `gr.BrowserState` change event (#10245)

* changes

* changes

* add changeset

* format

* changes

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>

* history

* changes

* changes

* changes

* history

* changes

* changes

* changes

* format

* add changeset

* changes

* changes

* more changes

* changes

* dataset changes

* changes

* add changeset

* add md variant for button

* add changeset

* changes

* changes

* format

* format

* add changeset

* changes

* changes

* more changes

* changes

* changes

* add changeset

* changes

* docs

* changes

* changes

* changes

* changes

* fix

* fix tests

* change

* add changeset

* fix logo issue

* changes

* version

* add changeset

* fix typecheck

* remove redundant

* pkg version

* add changeset

* changes

* Revert "changes"

This reverts commit 13bfe8c.

* reorganize code

* format

* changes

* add to deployed demos

* fix icons

* fix icon

* lint

* changes

* example

* changes

* fix buttons

* add changeset

* format

* add changeset

* update icon

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
Co-authored-by: Dawood <dawoodkhan82@gmail.com>
Co-authored-by: Dmitry Ustalov <dmitry.ustalov@gmail.com>
Co-authored-by: Freddy Boulton <alfonsoboulton@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BrowserState does not have a change event
3 participants