|
{% load static %} |
|
<!DOCTYPE html> |
|
<html lang="en"> |
|
<head> |
|
<meta charset="UTF-8"> |
|
<meta name="viewport" content="width=device-width, initial-scale=1.0"> |
|
<title>Upload and Predict</title> |
|
<style> |
|
body { |
|
font-family: 'Arial', "Times New Roman"; |
|
background-color: #88AB8E; |
|
text-align: center; |
|
margin: 50px; |
|
background-image: url('https://img.freepik.com/premium-vector/circuit-board-motherboard-blue-technology-background_322958-38.jpg'); |
|
background-repeat: no-repeat; |
|
background-attachment: fixed; |
|
background-size: 100% 100%; |
|
}Yes B |
|
.topnav { |
|
overflow: hidden; |
|
background-color: #333; |
|
margin-top: -40px; |
|
} |
|
.camera { |
|
overflow: hidden; |
|
} |
|
.topnav a { |
|
float: left; |
|
color: #f2f2f2; |
|
text-align: center; |
|
padding: 12px 10px; |
|
text-decoration: none; |
|
font-size: 25px; |
|
} |
|
.topnav a:hover { |
|
background-color: #ddd; |
|
color: black; |
|
} |
|
.topnav a.active { |
|
background-color: #333; |
|
color: white; |
|
} |
|
|
|
h1 { |
|
color: white; |
|
font-size: 90px; |
|
} |
|
h2 { |
|
color: yellow; |
|
font-size: 30px; |
|
} |
|
h3{ |
|
color: white; |
|
font-size: 30px; |
|
} |
|
|
|
form { |
|
max-width: 400px; |
|
margin: 0 auto; |
|
background-color: #fff; |
|
padding: 20px; |
|
border-radius: 8px; |
|
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); |
|
} |
|
|
|
label { |
|
display: block; |
|
margin-bottom: 10px; |
|
font-weight: bold; |
|
color: #333; |
|
} |
|
|
|
input[type="file"] { |
|
display: none; |
|
} |
|
|
|
.custom-file-upload { |
|
cursor: pointer; |
|
background-color: #4caf50; |
|
color: #fff; |
|
border: none; |
|
padding: 10px 20px; |
|
font-size: 16px; |
|
border-radius: 4px; |
|
transition: background-color 0.3s; |
|
} |
|
|
|
.custom-file-upload:hover { |
|
background-color: #45a049; |
|
} |
|
|
|
button[type="submit"] { |
|
background-color: #3498db; |
|
color: #fff; |
|
border: none; |
|
padding: 10px 20px; |
|
font-size: 16px; |
|
border-radius: 4px; |
|
cursor: pointer; |
|
transition: background-color 0.3s; |
|
} |
|
|
|
button[type="submit"]:hover { |
|
background-color: #2980b9; |
|
} |
|
|
|
#image-preview { |
|
max-width: 100%; |
|
height: auto; |
|
margin-top: 20px; |
|
display: none; |
|
} |
|
|
|
#image-name { |
|
font-size: 14px; |
|
color: #555; |
|
margin-top: 10px; |
|
display: none; |
|
} |
|
</style> |
|
</head> |
|
<body> |
|
<div class="topnav"> |
|
<a class="navbar-brand" href="http://127.0.0.1:8000/predict/"> |
|
<img alt="Attendify" src="https://t4.ftcdn.net/jpg/02/29/42/89/240_F_229428944_GrooUMPzQskyvYcYhFcY9SYrhslHnBdt.jpg" width="30" height="30"> |
|
</a> |
|
<a class="active"><i>Attendify</i></a> |
|
<a class="active"> | Welcome to DS Attendance System</a> |
|
</div> |
|
<h1><i>Attendify</i></h1> |
|
<h2>Mark Attendance</h2> |
|
<form method="post" enctype="multipart/form-data"> |
|
<fieldset> |
|
{% csrf_token %} |
|
<label for="id_image" class="custom-file-upload"> |
|
<div class="camera"> |
|
<a class="navbar-brand"> |
|
<img alt="Attendify" src="https://cdn-icons-png.flaticon.com/128/11312/11312727.png" width="30" height="30"> |
|
</a> |
|
</div> |
|
Select Image |
|
</label> |
|
<input type="file" id="id_image" name="image" onchange="previewImage(this)"> |
|
<img id="image-preview" alt="Selected Image"> |
|
<div id="image-name"></div> |
|
<br> |
|
<br> |
|
<br> |
|
</fieldset> |
|
<br> |
|
<button type="submit">Save</button> |
|
</form> |
|
|
|
<script> |
|
function previewImage(input) { |
|
var preview = document.getElementById('image-preview'); |
|
var imageName = document.getElementById('image-name'); |
|
var file = input.files[0]; |
|
var reader = new FileReader(); |
|
|
|
reader.onload = function (e) { |
|
preview.src = e.target.result; |
|
preview.style.display = 'block'; |
|
imageName.innerText = 'Selected Image: ' + file.name; |
|
imageName.style.display = 'block'; |
|
}; |
|
|
|
if (file) { |
|
reader.readAsDataURL(file); |
|
} else { |
|
preview.src = ''; |
|
preview.style.display = 'none'; |
|
imageName.innerText = ''; |
|
imageName.style.display = 'none'; |
|
} |
|
} |
|
</script> |
|
</body> |
|
</html> |
|
|