Closed hannahblair closed 2 weeks ago
• | Name | Status | URL |
---|---|---|---|
Spaces | ready! | Spaces preview | |
Website | failed! | Details | |
:unicorn: | Changes | detected! | Details |
Install Gradio from this PR
pip install https://gradio-builds.s3.amazonaws.com/c4265462b96bbf2dc247f9dd2b55fcf190dc3037/gradio-4.33.0-py3-none-any.whl
Install Gradio Python Client from this PR
pip install "gradio-client @ git+https://github.com/gradio-app/gradio@c4265462b96bbf2dc247f9dd2b55fcf190dc3037#subdirectory=client/python"
Install Gradio JS Client from this PR
npm install https://gradio-builds.s3.amazonaws.com/c4265462b96bbf2dc247f9dd2b55fcf190dc3037/gradio-client-0.20.1.tgz
Package | Version |
---|---|
@gradio/client |
patch |
gradio |
patch |
Improve file handling in JS Client
Maintainers or the PR author can modify the PR title to modify this entry.
Another case that should work is when the handle_file
is passed as part of a nested object or array:
const image_url = "https://raw.githubusercontent.com/gradio-app/gradio/main/test/test_files/bus.png";
const result = client.submit("/lambda", {
x: {
files: [handle_file(image_url), handle_file(image_url)]
}
})
Description
This PR adds a
handle_file
function, which converts aURL
orFile
toFileData
, or if it receives aBlob
, it will just return the Blob as the client handles that anyway. This PR also fixes an issue with image uploading.Methods of file handling that should work with this PR:
Passing a blob directly
Passing a blob to
handle_file
Passing an image URL to
handle_file
Passing an image URL as an object
Passing a local file path to
handle_file
Passing a
Buffer
tohandle_file
Passing an array of local image files to
handle_file
Closes: #6623 Closes: #8082 Closes: #7834 Closes: #8402 Clsoes: #8256
🎯 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
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
You may need to run the linters:
bash scripts/format_backend.sh
andbash scripts/format_frontend.sh