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

Fix image upload #6363

Merged
merged 3 commits into from Nov 10, 2023
Merged

Fix image upload #6363

merged 3 commits into from Nov 10, 2023

Conversation

freddyaboulton
Copy link
Collaborator

@freddyaboulton freddyaboulton commented Nov 9, 2023

Description

Fix image upload

🎯 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

  1. 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

  2. You may need to run the linters: bash scripts/format_backend.sh and bash scripts/format_frontend.sh

@gradio-pr-bot
Copy link
Contributor

gradio-pr-bot commented Nov 9, 2023

🪼 branch checks and previews

Name Status URL
Spaces ready! Spaces preview
Website ready! Website preview
Storybook ready! Storybook preview
Visual tests all good! Build review
🦄 Changes detected! Details

Install Gradio from this PR

pip install https://gradio-builds.s3.amazonaws.com/ad0cc31abe0a58e6ce15a3fbfe40294ffc5c0bef/gradio-4.1.2-py3-none-any.whl

Install Gradio Python Client from this PR

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

@gradio-pr-bot
Copy link
Contributor

gradio-pr-bot commented Nov 9, 2023

🦄 change detected

This Pull Request includes changes to the following packages.

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

With the following changelog entry.

Fix image upload

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.

@@ -122,7 +122,7 @@

<ImageUploader
bind:active_tool
bind:value={_value}
bind:value
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

What was happening is that we were binding to _value so the value prop (which is what gets passed to events) was never updated during the upload.

I think this is the right thing to do. By binding to value, _value will automatically be updated. Also the ImageUploaded calls normalise_file so value will have the right url

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Both of the test cases from #6322 work with this change as far as I can tell

image image

@freddyaboulton freddyaboulton added the v: patch A change that requires a patch release label Nov 9, 2023
@freddyaboulton freddyaboulton marked this pull request as ready for review November 9, 2023 23:58
@abidlabs
Copy link
Member

LGTM thanks @freddyaboulton for the nice fix!

@freddyaboulton
Copy link
Collaborator Author

Thanks for the reivew @abidlabs !!

@freddyaboulton freddyaboulton merged commit 4d3aad3 into main Nov 10, 2023
14 checks passed
@freddyaboulton freddyaboulton deleted the fix-image-upload branch November 10, 2023 00:57
@pngwn pngwn mentioned this pull request Nov 10, 2023
freddyaboulton added a commit that referenced this pull request Nov 10, 2023
* Fix upload

* add changeset

* add changeset

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
freddyaboulton added a commit that referenced this pull request Nov 13, 2023
* WIP guide

* Add remaining

* build command

* remove pin from guides

* add changeset

* Tweaks

* add changeset

* format

* Update guides/05_custom-components/07_pdf-component-example.md

Co-authored-by: Abubakar Abid <abubakar@huggingface.co>

* Redesign file upload (#6356)

* Textbox and Code Component Blur/Focus Fixes (#6323)

* focus and blur events

* format

* add changeset

* fixes

* fixes

* format

---------

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

* Fix image upload (#6363)

* Fix upload

* add changeset

* add changeset

---------

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

* Add demo to the beginning

* Add example and note about the name

* Incorporate feedback

---------

Co-authored-by: aliabd <ali.si3luwa@gmail.com>
Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
Co-authored-by: Hannah <hannahblair@users.noreply.github.com>
Co-authored-by: Dawood Khan <dawoodkhan82@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
v: patch A change that requires a patch release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants