Closed pngwn closed 2 weeks ago
• | Name | Status | URL |
---|---|---|---|
Spaces | ready! | Spaces preview | |
Website | ready! | Website preview | |
Storybook | ready! | Storybook preview | |
:unicorn: | Changes | detected! | Details |
Install Gradio from this PR
pip install https://gradio-builds.s3.amazonaws.com/a20e4c4ddca976b10afc450e425e6c3bea8ebaaf/gradio-4.28.3-py3-none-any.whl
Install Gradio Python Client from this PR
pip install "gradio-client @ git+https://github.com/gradio-app/gradio@a20e4c4ddca976b10afc450e425e6c3bea8ebaaf#subdirectory=client/python"
Package | Version |
---|---|
@gradio/app |
patch |
@gradio/audio |
patch |
@gradio/client |
patch |
@gradio/dataframe |
patch |
@gradio/file |
patch |
@gradio/gallery |
patch |
@gradio/image |
patch |
@gradio/imageeditor |
patch |
@gradio/model3d |
patch |
@gradio/multimodaltextbox |
patch |
@gradio/simpleimage |
patch |
@gradio/storybook |
patch |
@gradio/tootils |
patch |
@gradio/upload |
patch |
@gradio/uploadbutton |
patch |
@gradio/utils |
patch |
@gradio/video |
patch |
gradio |
patch |
rework upload to be a class method + pass client into each component
Maintainers or the PR author can modify the PR title to modify this entry.
storybook should be fine now.
There's an issue with the Trim Video
snapshot in storybook which is specific to this PR; at first glance I can't see why this would cause it but I can delve into it tmo. Otherwise, looks good - thanks for making the upload logic a lot cleaner! Also, the comments really helped :-)
edit: no worries the trim video snapshot is just a red herring
Description
Closes #8150.
This PR reworks the
upload
function exported from@gradio/client
to instead be an instance method of the client. This means we do not need to pass theupload_fn
in and can instead usethis.upload_files
which usesthis.fetch_implementation
. This simplifies things significantly as the lite client and core client define their own fetch and stream methods.To further reduce the complexity of the code base, i decide to pass the client into each component on the
gradio
namespace. This allows components to fetch/ stream as needed using the client methods (which are set appropriately for their environment) without us needing to pass individual function using svelte's context.Wherever an
upload
function is required, the component can simply call it or pass it down.