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

Fixes Drag and Drop for Upload #6525

Merged
merged 63 commits into from Dec 13, 2023
Merged

Fixes Drag and Drop for Upload #6525

merged 63 commits into from Dec 13, 2023

Conversation

dawoodkhan82
Copy link
Collaborator

Description

Fixes the issue around the mime-type checks in the Upload component, which was causing errors for drag and dropping files.

Closes: #6490

🎯 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 21, 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/f135675966e52c7066411dcede2b1ede1f05f768/gradio-4.9.0-py3-none-any.whl

Install Gradio Python Client from this PR

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

@gradio-pr-bot
Copy link
Contributor

gradio-pr-bot commented Nov 21, 2023

🦄 change detected

This Pull Request includes changes to the following packages.

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

With the following changelog entry.

Fixes Drag and Drop for 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.

Copy link
Collaborator

@freddyaboulton freddyaboulton left a comment

Choose a reason for hiding this comment

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

Can you modify the model3d_component_events.spec.ts and maybe write some 2e2 tests for gr.File? We have some for UploadButton but not File. There's an example of DnD in video_component_events.spec.ts.

dawoodkhan82 and others added 25 commits November 23, 2023 01:49
* clog version

* add changeset

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
* Fix version in other changelog

why do we have 2?

* remove changeset
* fix text alignment when rtl is true

* add changeset

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
* amend like/dislike logic

* add like/dislike to chatbot demo and add e2e test

* add changeset

* e2e test changes

* revert chatbot_component changes

* tweak

* generate notebooks

* tweak

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
* feat: make UploadButton accept icon

* add changeset

* add proxy url prop

* add stories

---------

Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
…changes to root, glob, or glob_dir (#6550)

* Add code

* add changeset

* add changeset

* Add test

* fix

---------

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

* Fix uploaded file wasn't moved to custom temp dir at different disks

* add changeset

* Update routes.py

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
Co-authored-by: Freddy Boulton <alfonsoboulton@gmail.com>
* Fix the docstring of the `Slider` class

* add changeset

* Update the JSON file generator to output a new field .styled_description to render the inline code syntax in the description field

* add changeset

* Update style_types() to deal with backticks and single asterisks

* Update the inline style converter to use regex for the curly bracket syntax as well

* Revert `style_types()` not to touch the `description` field and update the frontend code to apply styling to such formatted texts on Svelte's side

* Apply the inline styler to other `.description` field appearances

* Apply the inline styler to `.preprocessing`, `.postprocessing`, `.examples-format`, `.events`, and `*.parameters.doc`

* Stop applying HTML styles to the JSON data, instaed apply HTML escaping

* Escape HTML tokens in .parameters[]["doc"] too

* fixes

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
Co-authored-by: Ali Abdalla <ali.si3luwa@gmail.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
* Update zh-CN.json

* add changeset

* format

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
* client with private space

* add changeset

* lint

* add test

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
…unt=single mode (return None rather) (#6607)

* Update file_explorer.py

Fixing error if nothing selected in file_count=single mode (return None rather)

* add changeset

* added unit tests

---------

Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
* remove 2 slider demos

* add changeset

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
* fix: configure default encoding as utf-8

* apply doc change for the fix

* apply cn doc change for the fix

* add changeset

* Lint

---------

Co-authored-by: Freddy Boulton <alfonsoboulton@gmail.com>
Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
* fixes

* add changeset

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
* amend trimming logic and return original file when error occurs

* add interactive story test

* add changeset

* add changeset

---------

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

* add changeset

* add animation

* Refactor audio component and waveform options

* formatting

* add margin before audio controls

* amend default values

* expose gr.WaveformOptions

* Tweak waveform options types and handle none

* add waveform_options to reverse_audio

* tweak bool typing

* notebook

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
…cy_limit (#6653)

* concurrency limit chat interface

* add changeset

* Update gradio/chat_interface.py

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

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
@dawoodkhan82
Copy link
Collaborator Author

dawoodkhan82 commented Dec 11, 2023

Hmm, so the failing functional tests, are actually passing for me locally. Also by re-running these tests I notice some of them are pretty flaky. Specifically any test using the upload endpoint. await page.waitForResponse("**/upload?*");

whitphx and others added 12 commits December 12, 2023 10:55
…he container styles (#6726)

* Remove the styles from the Image/Video primitive components and Fix the container styles

* add changeset

* Fix image example size styles

* Remove border from image/Example with type=gallery

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
@dawoodkhan82
Copy link
Collaborator Author

Tests are passing now! Ready for re-review @abidlabs @freddyaboulton

@abidlabs
Copy link
Member

abidlabs commented Dec 13, 2023

Nice @dawoodkhan82! The issue is fixed for me for the gr.File component, but not for the gr.Model3D component. Here's the code I'm trying, and I'm attaching the file (its a .obj file but I've zipped it to be able to upload to GH) as well. Are you able to repro?

import gradio as gr

def noop(*args):
    return None

demo = gr.Interface(
    fn=noop,
    inputs=[gr.File(), gr.Model3D(), gr.Image()],
    outputs=None,
)

demo.launch()

Bunny.obj.zip

@abidlabs
Copy link
Member

abidlabs commented Dec 13, 2023

@dawoodkhan82 and I looked into the issue above, it seems like it only affects .obj files

@dawoodkhan82
Copy link
Collaborator Author

@abidlabs Fixed, without (hopefully) breaking anything else!

@abidlabs
Copy link
Member

Awesome @dawoodkhan82 works for me! Thanks for finding the solution.

@abidlabs
Copy link
Member

I'll go ahead and merge this in so that we can do a patch release with #6693 and this

@abidlabs abidlabs merged commit 5d51fbc into main Dec 13, 2023
20 checks passed
@abidlabs abidlabs deleted the upload branch December 13, 2023 22:48
@pngwn pngwn mentioned this pull request Dec 13, 2023
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.

gr.File() and gr.Model3D don't accept DnD (drag and drop) input