2023-11-20 15:53:42 +01:00
|
|
|
<!DOCTYPE html>
|
|
|
|
<html lang="en">
|
|
|
|
{% load static %}
|
|
|
|
<head>
|
|
|
|
<meta charset="UTF-8">
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
|
|
<title>Plankton Detector</title>
|
|
|
|
<link rel="stylesheet" href="{% static 'DetectionApp/css/styles.css' %}">
|
|
|
|
<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
|
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
|
|
|
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@300&display=swap" rel="stylesheet">
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<form method="POST" enctype="multipart/form-data">
|
|
|
|
{% csrf_token %}
|
|
|
|
<div class="side_menu">
|
|
|
|
{% if not img_saved%}
|
|
|
|
<p id="description">Choose image for analysis</p>
|
|
|
|
{% else %}
|
|
|
|
<p id="description">Photo saved</p>
|
|
|
|
{%endif%}
|
|
|
|
<input type="submit" id="submit" value="Submit">
|
|
|
|
</div>
|
|
|
|
<div class="upload_field">
|
|
|
|
<label for="id_image", class="upload_button">
|
|
|
|
{{form.as_p}}
|
|
|
|
{% if not img_path %}
|
2023-11-27 16:52:09 +01:00
|
|
|
<img id="image-preview" src="{% static 'DetectionApp/images/upload_img.png' %}" alt="Image Preview" style="max-width:640px; max-height:640px;"/>
|
2023-11-20 15:53:42 +01:00
|
|
|
{%else%}
|
2023-11-27 16:52:09 +01:00
|
|
|
<img src="{%get_media_prefix %}{{img_path}}" alt="upload_image" width="640" height="640">
|
2023-11-20 15:53:42 +01:00
|
|
|
{%endif%}
|
|
|
|
</label>
|
|
|
|
</div>
|
|
|
|
</form>
|
2023-11-27 16:52:09 +01:00
|
|
|
<script>
|
|
|
|
document.getElementById('id_image').addEventListener('change', function() {
|
|
|
|
var input = this;
|
|
|
|
|
|
|
|
if (input.files && input.files[0]) {
|
|
|
|
var reader = new FileReader();
|
|
|
|
|
|
|
|
reader.onload = function(e) {
|
|
|
|
document.getElementById('image-preview').src = e.target.result;
|
|
|
|
document.getElementById('image-preview').style.display = 'block';
|
|
|
|
}
|
|
|
|
|
|
|
|
reader.readAsDataURL(input.files[0]);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
</form>
|
2023-11-20 15:53:42 +01:00
|
|
|
</body>
|
|
|
|
</html>
|