我有
index.html
<p>input an image</p>
<p>
<form>
<input type="file" name="pic" accept="image/.jpg" onchange="loadFile(event)"></input>
<img id="output"/>
<script>
var loadFile = function(event) {
var output = document.getElementById('output');
output.src = URL.createObjectURL(event.target.files[0]);
};
</script>
</form>
</p>
<p>
<form>
<input type="submit" value="result"></input>
</form>
</p>
views.py
def test(request):
if request.POST:
d = request.POST.dict()
img = d.get("pic")
a=image_array(img) # convert image to array use to test model
r=model(a) #
return render(request, "./index.html",r)
else:
return render(request, "./index.html")
如何在“提交”按钮下方显示预测结果?