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 upload file delay #4661
fix upload file delay #4661
Conversation
All the demos for this PR have been deployed at https://huggingface.co/spaces/gradio-pr-deploys/pr-4661-all-demos |
Ah, my bad. Nice catch. |
@@ -80,10 +81,11 @@ | |||
file_data.orig_name = file_data.name; | |||
file_data.name = response.files[i]; | |||
file_data.is_file = true; | |||
file_data.blob = null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Think we just need to use undefined
for all of these empty blob values and those errors.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
beat me to it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested and working. Looks good to me! Thanks @aliabid94!
Thanks guys! Will go ahead and merge in so that we can work on reducing the number of open PRs! |
* fix * changes * changes --------- Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
* playwright tests for chatbot * more tests * changelog * Update CHANGELOG.md * fix upload file delay (#4661) * fix * changes * changes --------- Co-authored-by: Abubakar Abid <abubakar@huggingface.co> * Forward `tqdm` constructor arguments to `Progress` component (#4475) * Forward tqdm constructor arguments to Progress component Signed-off-by: Ilya Trushkin <ilya.trushkin@intel.com> * lint * reorder args * added tests --------- Signed-off-by: Ilya Trushkin <ilya.trushkin@intel.com> Co-authored-by: Abubakar Abid <abubakar@huggingface.co> * Remove cleared_value (#4685) * Remove cleared_value * CHANGELOG * Add requirements.txt to dialogpt demo (#4686) * Add requirements.txt * Update demo notebook * Add torch * remove streaming demo + more tests * Fix blocks_kitchen_sink and streaming_stt demos (#4699) * Add code * Add json file * Remove streaming_stt demo * Undo generate_notebooks * Add blocks_kitchen_sink * fix tests * Update js/app/test/chatbot_multimodal.spec.ts Co-authored-by: pngwn <hello@pngwn.io> * Update js/app/test/chatbot_multimodal.spec.ts Co-authored-by: pngwn <hello@pngwn.io> * Update js/app/test/chatbot_multimodal.spec.ts Co-authored-by: pngwn <hello@pngwn.io> * Update js/app/test/chatbot_multimodal.spec.ts Co-authored-by: pngwn <hello@pngwn.io> * Update js/app/test/chatbot_multimodal.spec.ts Co-authored-by: pngwn <hello@pngwn.io> * Update js/app/test/chatbot_multimodal.spec.ts Co-authored-by: pngwn <hello@pngwn.io> * Update js/app/test/chatbot_multimodal.spec.ts Co-authored-by: pngwn <hello@pngwn.io> * Update js/app/test/chatbot_multimodal.spec.ts Co-authored-by: pngwn <hello@pngwn.io> * Update js/app/test/chatbot_multimodal.spec.ts Co-authored-by: pngwn <hello@pngwn.io> * update notebook * remove debug * remove debug --------- Signed-off-by: Ilya Trushkin <ilya.trushkin@intel.com> Co-authored-by: aliabid94 <aabid94@gmail.com> Co-authored-by: Abubakar Abid <abubakar@huggingface.co> Co-authored-by: Ilya Trushkin <ilya.trushkin@intel.com> Co-authored-by: Freddy Boulton <alfonsoboulton@gmail.com> Co-authored-by: pngwn <hello@pngwn.io>
There was a delay between an uploaded file and then trigger for
change
andupload
listeners. This was caused by the fact that files were actually getting uploaded twice, once in the svelte File component, and once in the client library when submitting data. This us because the client looks to see if there's any blob in the component data and uploads it. I removed the blob in the component so that the client does not resubmit - ideally we could let the client handle all uploading but the upload animation and dispatching of "change" and "submit" within the component won't work with that, so it's handled only in the component now.Fixes: #4385
To test, run any demo that has a change or upload trigger on file, example below. Previously, you would see a lag between the finishing of the upload animation and triggering of the backend. You would also two network requests made "/upload" made sequentially. These should be fixed.