【发布时间】:2019-12-04 19:59:37
【问题描述】:
Using a pre-trained model for image classification, I created a webpage that in theory will allow the user to browse their computer for a image and when that image is selected, it is automatically processed and the top three responses for what that最有可能的图像以及每个图像的概率显示在网页上。我的 JS 函数可能非常错误,我有点自学。如果有帮助,我也会使用 materializecss 和 tensorflow.js。
我无法使用所选的用户图像更改我目前在那里硬编码的图像。
HTML
<div name="imagePost" class="offset-s1 col s6">
<img class="responsive-img" id="changeImage" src="images/dog.jpg" alt="description">
<input type="file" name="pickImage" onchange="swapImage(pickImage)">
</div>
JS函数
function swapImage (pickImage) {
var image_toShow = pickImage;
document.getElementById('changeImage').innerHTML = image_toShow;
}
【问题讨论】:
-
stackoverflow.com/questions/4459379/… 我知道答案是 jQuery,但使用文件阅读器的基本思路
-
您是否只是将 innerHTML 设置为参数中提供的内容?或者,您是在构建图像标签吗?
标签: javascript html materialize tensorflow.js