mirror of
https://github.com/gradio-app/gradio.git
synced 2025-01-12 10:34:32 +08:00
20 lines
492 B
JavaScript
20 lines
492 B
JavaScript
|
|
var imageLoader = document.getElementById('filePhoto');
|
|
imageLoader.addEventListener('change', handleImage, false);
|
|
|
|
function handleImage(e) {
|
|
var reader = new FileReader();
|
|
reader.onload = function (event) {
|
|
|
|
$('.uploader img').attr('src',event.target.result);
|
|
}
|
|
reader.readAsDataURL(e.target.files[0]);
|
|
}
|
|
|
|
$('#submit-button').click(function(e){
|
|
var src = $('.uploader img').attr('src');
|
|
ws.send(src, function(e){
|
|
notifyError(e)
|
|
});
|
|
})
|