|
|
|
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Object Detection Result</title>
|
|
<style>
|
|
body {
|
|
display: flex;
|
|
flex-direction: column;
|
|
align-items: center;
|
|
justify-content: flex-start;
|
|
height: 100vh;
|
|
margin: 0;
|
|
}
|
|
|
|
h1 {
|
|
margin-bottom: 20px;
|
|
}
|
|
|
|
#loading {
|
|
display: none;
|
|
}
|
|
|
|
#output {
|
|
max-width: 100%;
|
|
height: auto;
|
|
display: none;
|
|
}
|
|
|
|
#output-video {
|
|
max-width: 100%;
|
|
height: auto;
|
|
display: none;
|
|
}
|
|
</style>
|
|
<script async src="https://docs.opencv.org/master/opencv.js" onload="onOpenCvReady();" type="text/javascript"></script>
|
|
<script type="text/javascript">
|
|
function onOpenCvReady() {
|
|
var isVideo = "{{ is_video }}";
|
|
if (isVideo === "true") {
|
|
document.getElementById("output-video").src = "{{ output_image }}";
|
|
document.getElementById("output-video").style.display = "block";
|
|
} else {
|
|
document.getElementById("output").src = "{{ output_image }}";
|
|
document.getElementById("output").style.display = "block";
|
|
}
|
|
document.getElementById("loading").style.display = "none";
|
|
}
|
|
|
|
|
|
function showLoading() {
|
|
document.getElementById("loading").style.display = "block";
|
|
}
|
|
</script>
|
|
</head>
|
|
<body>
|
|
<h1>Object Detection Result</h1>
|
|
<form action="/detect/" method="post" enctype="multipart/form-data" onsubmit="showLoading();">
|
|
<label for="file">Upload an Image or Video :</label>
|
|
<input type="file" id="file" name="file" accept=".jpg, .jpeg, .png, .mp4, .mov" required>
|
|
<button type="submit">Detect</button>
|
|
</form>
|
|
<br/>
|
|
<div id="loading">Loading...</div>
|
|
<img id="output"/>
|
|
<video id="output-video" controls></video>
|
|
</body>
|
|
</html>
|
|
|