fix upload file delay (#4661)

* fix

* changes

* changes

---------

Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
This commit is contained in:
aliabid94 2023-06-26 06:14:00 -07:00 committed by GitHub
parent 9e13cf3890
commit 7b8fbb17c8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 1 deletions

View File

@ -18,6 +18,7 @@
- Fixed Dropdown height rendering in Columns by [@aliabid94](https://github.com/aliabid94) in [PR 4584](https://github.com/gradio-app/gradio/pull/4584)
- Fixed bug where `AnnotatedImage` css styling was causing the annotation masks to not be displayed correctly by [@freddyaboulton](https://github.com/freddyaboulton) in [PR 4628](https://github.com/gradio-app/gradio/pull/4628)
- Ensure that Gradio does not silently fail when running on a port that is occupied by [@abidlabs](https://github.com/abidlabs) in [PR 4624](https://github.com/gradio-app/gradio/pull/4624).
- Fix double upload bug that caused lag in file uploads by [@aliabid94](https://github.com/aliabid94) in [PR 4661](https://github.com/gradio-app/gradio/pull/4661)
## Other Changes:

View File

@ -71,6 +71,7 @@
(Array.isArray(_value) ? _value : [_value]).forEach(
async (file_data, i) => {
file_data.data = await blobToBase64(file_data.blob!);
file_data.blob = undefined;
}
);
} else {
@ -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 = undefined;
}
}
);
_value = normalise_file(value, root, root_url);
old_value = _value = normalise_file(value, root, root_url);
}
dispatch("change");
dispatch("upload");

View File

@ -32,6 +32,7 @@
(Array.isArray(detail) ? detail : [detail]).forEach(
async (file_data, i) => {
file_data.data = await blobToBase64(file_data.blob!);
file_data.blob = undefined;
}
);
} else {
@ -40,6 +41,7 @@
file_data.orig_name = file_data.name;
file_data.name = response.files[i];
file_data.is_file = true;
file_data.blob = undefined;
}
});
}